Skip to content

Commit

Permalink
Formatting and old array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyWay committed Oct 1, 2014
1 parent 5146b56 commit 4a21576
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 39 deletions.
33 changes: 11 additions & 22 deletions src/Way/Generators/Commands/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
abstract class GeneratorCommand extends Command {

/**
* @var \Way\Generators\Generator
* The Generator instance.
*
* @var Generator
*/
protected $generator;

/**
* Create a new GeneratorCommand instance.
*
* @param Generator $generator
*/
public function __construct(Generator $generator)
Expand All @@ -25,28 +29,28 @@ public function __construct(Generator $generator)
}

/**
* Fetch the template data
* Fetch the template data.
*
* @return array
*/
protected abstract function getTemplateData();

/**
* The path where the file will be created
* The path to where the file will be created.
*
* @return mixed
*/
protected abstract function getFileGenerationPath();

/**
* Get the path to the generator template
* Get the path to the generator template.
*
* @return mixed
*/
protected abstract function getTemplatePath();

/**
* Compile and generate the file
* Compile and generate the file.
*/
public function fire()
{
Expand All @@ -70,30 +74,15 @@ public function fire()
}

/**
* Get the full namespace.
*
* @param string $type
* @return string
*/
protected function getNamespace($type)
{
return trim($this->laravel['config']['namespaces.'.$type], '\\');
}

/**
* Get a directory path either through a
* command option, or from the configuration
* Get a directory path through a command option, or from the configuration.
*
* @param $option
* @param $configName
* @return string
*/
protected function getPathByOptionOrConfig($option, $configName)
{
if ($path = $this->option($option))
{
return $path;
}
if ($path = $this->option($option)) return $path;

return Config::get("generators::config.{$configName}");
}
Expand Down
10 changes: 5 additions & 5 deletions src/Way/Generators/Commands/MigrationGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ protected function getTemplatePath()
*/
protected function getArguments()
{
return array(
array('migrationName', InputArgument::REQUIRED, 'The migration name')
);
return [
['migrationName', InputArgument::REQUIRED, 'The migration name']
];
}

/**
Expand All @@ -97,12 +97,12 @@ protected function getArguments()
*/
protected function getOptions()
{
return array(
return [
['fields', null, InputOption::VALUE_OPTIONAL, 'Fields for the migration'],
['path', null, InputOption::VALUE_OPTIONAL, 'Where should the file be created?'],
['templatePath', null, InputOption::VALUE_OPTIONAL, 'The location of the template for this generator'],
['testing', null, InputOption::VALUE_OPTIONAL, 'For internal use only.']
);
];
}

}
6 changes: 3 additions & 3 deletions src/Way/Generators/Commands/ModelGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ModelGeneratorCommand extends GeneratorCommand {
protected $description = 'Generate a model';

/**
* The path where the file will be created
* The path to where the file will be created.
*
* @return mixed
*/
Expand All @@ -32,7 +32,7 @@ protected function getFileGenerationPath()
}

/**
* Fetch the template data
* Fetch the template data.
*
* @return array
*/
Expand All @@ -45,7 +45,7 @@ protected function getTemplateData()
}

/**
* Get path to the template for the generator
* Get path to the template for the generator.
*
* @return mixed
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Way/Generators/Commands/PivotGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function sortDesiredTables()
}

/**
* Get the fields for the pivot migration
* Get the fields for the pivot migration.
*
* @param $tableOne
* @param $tableTwo
Expand Down
6 changes: 3 additions & 3 deletions src/Way/Generators/Commands/SeederGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ protected function getTemplatePath()
*/
protected function getArguments()
{
return array(
array('tableName', InputArgument::REQUIRED, 'The name of the table to seed')
);
return [
['tableName', InputArgument::REQUIRED, 'The name of the table to seed']
];
}

/**
Expand Down
9 changes: 4 additions & 5 deletions src/Way/Generators/Commands/ViewGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class ViewGeneratorCommand extends GeneratorCommand {
protected $description = 'Generate a view';

/**
* Create directory tree for views,
* and fire generator
* Create directory tree for views, and fire the generator.
*/
public function fire()
{
Expand All @@ -37,7 +36,7 @@ public function fire()
}

/**
* The path where the file will be created
* The path to where the file will be created.
*
* @return mixed
*/
Expand All @@ -50,7 +49,7 @@ protected function getFileGenerationPath()
}

/**
* Fetch the template data
* Fetch the template data.
*
* @return array
*/
Expand All @@ -62,7 +61,7 @@ protected function getTemplateData()
}

/**
* Get path to the template for the generator
* Get the path to the template for the generator.
*
* @return mixed
*/
Expand Down

0 comments on commit 4a21576

Please sign in to comment.