diff --git a/src/Way/Generators/Commands/GeneratorCommand.php b/src/Way/Generators/Commands/GeneratorCommand.php index d1838ff..2b6f1f1 100644 --- a/src/Way/Generators/Commands/GeneratorCommand.php +++ b/src/Way/Generators/Commands/GeneratorCommand.php @@ -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) @@ -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() { @@ -70,19 +74,7 @@ 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 @@ -90,10 +82,7 @@ protected function getNamespace($type) */ 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}"); } diff --git a/src/Way/Generators/Commands/MigrationGeneratorCommand.php b/src/Way/Generators/Commands/MigrationGeneratorCommand.php index a8512f7..53ad18f 100644 --- a/src/Way/Generators/Commands/MigrationGeneratorCommand.php +++ b/src/Way/Generators/Commands/MigrationGeneratorCommand.php @@ -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'] + ]; } /** @@ -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.'] - ); + ]; } } diff --git a/src/Way/Generators/Commands/ModelGeneratorCommand.php b/src/Way/Generators/Commands/ModelGeneratorCommand.php index 0eb2757..956a8e5 100644 --- a/src/Way/Generators/Commands/ModelGeneratorCommand.php +++ b/src/Way/Generators/Commands/ModelGeneratorCommand.php @@ -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 */ @@ -32,7 +32,7 @@ protected function getFileGenerationPath() } /** - * Fetch the template data + * Fetch the template data. * * @return array */ @@ -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 */ diff --git a/src/Way/Generators/Commands/PivotGeneratorCommand.php b/src/Way/Generators/Commands/PivotGeneratorCommand.php index f00bc39..a6ce723 100644 --- a/src/Way/Generators/Commands/PivotGeneratorCommand.php +++ b/src/Way/Generators/Commands/PivotGeneratorCommand.php @@ -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 diff --git a/src/Way/Generators/Commands/SeederGeneratorCommand.php b/src/Way/Generators/Commands/SeederGeneratorCommand.php index 281770f..215e2e0 100644 --- a/src/Way/Generators/Commands/SeederGeneratorCommand.php +++ b/src/Way/Generators/Commands/SeederGeneratorCommand.php @@ -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'] + ]; } /** diff --git a/src/Way/Generators/Commands/ViewGeneratorCommand.php b/src/Way/Generators/Commands/ViewGeneratorCommand.php index fc3758e..bbb41e4 100644 --- a/src/Way/Generators/Commands/ViewGeneratorCommand.php +++ b/src/Way/Generators/Commands/ViewGeneratorCommand.php @@ -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() { @@ -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 */ @@ -50,7 +49,7 @@ protected function getFileGenerationPath() } /** - * Fetch the template data + * Fetch the template data. * * @return array */ @@ -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 */