Skip to content

Commit

Permalink
use camel case for mutation name
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissm79 committed Jul 2, 2016
1 parent 8b74b8c commit 34427e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Support/Console/Commands/MutationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,20 @@ protected function getOptions()
['relay', null, InputOption::VALUE_NONE, 'Generate a Relay Mutation.'],
];
}

/**
* Replace the class name for the given stub.
*
* @param string $stub
* @param string $name
* @return string
*/
protected function replaceClass($stub, $name)
{
$class = str_replace($this->getNamespace($name).'\\', '', $name);

$stub = str_replace('DummyCamelClass', camel_case($class), $stub);

return str_replace('DummyClass', $class, $stub);
}
}
2 changes: 1 addition & 1 deletion src/Support/Console/Commands/stubs/mutation.stub
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DummyClass extends GraphQLMutation
* @var array
*/
protected $attributes = [
'name' => 'DummyClass'
'name' => 'DummyCamelClass'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Console/Commands/stubs/relay_mutation.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DummyClass extends GraphQLMutation implements RelayMutation
* @var array
*/
protected $attributes = [
'name' => 'DummyClass'
'name' => 'DummyCamelClass'
];

/**
Expand Down

0 comments on commit 34427e7

Please sign in to comment.