@@ -85,7 +85,7 @@ |
||
| 85 | 85 | protected function setOptions(): array |
| 86 | 86 | { |
| 87 | 87 | return [ |
| 88 | - ['type', $this->types, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.', $this->types[0]] |
|
| 88 | + [ 'type', $this->types, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.', $this->types[ 0 ] ] |
|
| 89 | 89 | ]; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function getTableName(): string |
| 60 | 60 | { |
| 61 | - return once(function () { |
|
| 61 | + return once(function() { |
|
| 62 | 62 | return $this->option('table') ?? $this->ask('What is the name of the table/collection?', strtolower(Str::plural($this->getModuleName()))); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | protected function setOptions() :array |
| 72 | 72 | { |
| 73 | 73 | return [ |
| 74 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null], |
|
| 75 | - ['table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null], |
|
| 74 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null ], |
|
| 75 | + [ 'table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null ], |
|
| 76 | 76 | ]; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | protected function isMongoMigration(): bool |
| 80 | 80 | { |
| 81 | - return once(function () { |
|
| 81 | + return once(function() { |
|
| 82 | 82 | $option = $this->option('mongo'); |
| 83 | 83 | if ($option !== null) |
| 84 | - $option = (bool)$option; |
|
| 84 | + $option = (bool) $option; |
|
| 85 | 85 | |
| 86 | 86 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
| 87 | 87 | }); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function getDestinationFilePath() :string |
| 106 | 106 | { |
| 107 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getDestinationFileName() . '.php'; |
|
| 107 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getDestinationFileName().'.php'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -112,6 +112,6 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function getDestinationFileName() |
| 114 | 114 | { |
| 115 | - return date('Y_m_d_His_') . split_caps_to_underscore($this->getClassName()); |
|
| 115 | + return date('Y_m_d_His_').split_caps_to_underscore($this->getClassName()); |
|
| 116 | 116 | } |
| 117 | 117 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | protected function setOptions(): array |
| 69 | 69 | { |
| 70 | 70 | return [ |
| 71 | - ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null], |
|
| 71 | + [ 'command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', null ], |
|
| 72 | 72 | ]; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return $this->getOption('command'); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - protected function handleCommandOption($shortcut, $type, $question, $default){ |
|
| 84 | - return $this->ask('What is the name of the terminal command?',str_replace('command', '', strtolower($this->getModuleName()) . ':' . strtolower($this->getClassName()))); |
|
| 83 | + protected function handleCommandOption($shortcut, $type, $question, $default) { |
|
| 84 | + return $this->ask('What is the name of the terminal command?', str_replace('command', '', strtolower($this->getModuleName()).':'.strtolower($this->getClassName()))); |
|
| 85 | 85 | } |
| 86 | 86 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function getPath() |
| 19 | 19 | { |
| 20 | - return get_foundation_path() . '/Generator/Stubs/' . $this->path; |
|
| 20 | + return get_foundation_path().'/Generator/Stubs/'.$this->path; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function getName() |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function setArguments(): array |
| 28 | 28 | { |
| 29 | - return []; |
|
| 29 | + return [ ]; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -36,6 +36,6 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | protected function setOptions() :array |
| 38 | 38 | { |
| 39 | - return []; |
|
| 39 | + return [ ]; |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | |
| 76 | 76 | protected function getFileName() :string |
| 77 | 77 | { |
| 78 | - return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion() . '.php'; |
|
| 78 | + return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion().'.php'; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | protected function setOptions(): array |
| 66 | 66 | { |
| 67 | 67 | return [ |
| 68 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false], |
|
| 69 | - ['migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true], |
|
| 68 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false ], |
|
| 69 | + [ 'migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true ], |
|
| 70 | 70 | ]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - protected function handleMongoOption($shortcut, $type, $question, $default){ |
|
| 73 | + protected function handleMongoOption($shortcut, $type, $question, $default) { |
|
| 74 | 74 | return $this->confirm('Is this model for a mongodb database?', $default); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | return $this->getOption('mongo'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - protected function handleMigrationOption($shortcut, $type, $question, $default){ |
|
| 82 | + protected function handleMigrationOption($shortcut, $type, $question, $default) { |
|
| 83 | 83 | return $this->confirm('Do you want to create a migration for this model?', $default); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | if ($this->needsMigration()) { |
| 94 | 94 | if ($this->isMongoModel()) { |
| 95 | 95 | GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())->createMigration( |
| 96 | - "Create" . ucfirst($this->getClassName()) . "Collection", |
|
| 96 | + "Create".ucfirst($this->getClassName())."Collection", |
|
| 97 | 97 | strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))), |
| 98 | 98 | true); |
| 99 | 99 | } else { |
| 100 | 100 | GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())->createMigration( |
| 101 | - "Create" . ucfirst($this->getClassName() . "Table"), |
|
| 101 | + "Create".ucfirst($this->getClassName()."Table"), |
|
| 102 | 102 | strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))), |
| 103 | 103 | false); |
| 104 | 104 | } |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ModelGeneratedEvent extends ResourceGeneratedEvent |
| 20 | 20 | { |
| 21 | - public function isMongoModel(){ |
|
| 22 | - return $this->getStub()->getOptions()['MONGO']; |
|
| 21 | + public function isMongoModel() { |
|
| 22 | + return $this->getStub()->getOptions()[ 'MONGO' ]; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function includesMigration(){ |
|
| 26 | - return $this->getStub()->getOptions()['MIGRATION']; |
|
| 25 | + public function includesMigration() { |
|
| 26 | + return $this->getStub()->getOptions()[ 'MIGRATION' ]; |
|
| 27 | 27 | } |
| 28 | 28 | } |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | protected function setArguments() :array |
| 28 | 28 | { |
| 29 | 29 | return [ |
| 30 | - ['name', InputArgument::OPTIONAL, 'The name of the ' . $this->getGeneratorName() . '.'] |
|
| 30 | + [ 'name', InputArgument::OPTIONAL, 'The name of the '.$this->getGeneratorName().'.' ] |
|
| 31 | 31 | ]; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function handleNameArgument() |
| 35 | 35 | { |
| 36 | - return $this->ask('Specify the name of the ' . $this->getGeneratorName() . '.'); |
|
| 36 | + return $this->ask('Specify the name of the '.$this->getGeneratorName().'.'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected function getFileName() :string |
| 43 | 43 | { |
| 44 | - return $this->getClassName() . '.php'; |
|
| 44 | + return $this->getClassName().'.php'; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function getClassNamespace(): string |
| 54 | 54 | { |
| 55 | - return $this->getModule()->getNamespace() . str_replace('/', '\\', $this->filePath); |
|
| 55 | + return $this->getModule()->getNamespace().str_replace('/', '\\', $this->filePath); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - protected function getClassName(){ |
|
| 58 | + protected function getClassName() { |
|
| 59 | 59 | $className = $this->getArgument('name'); |
| 60 | - if($className===null){ |
|
| 60 | + if ($className === null) { |
|
| 61 | 61 | $this->error('class name not specified'); |
| 62 | - throw new \Exception('Name of ' . $this->getGeneratorName() . ' not set.'); |
|
| 62 | + throw new \Exception('Name of '.$this->getGeneratorName().' not set.'); |
|
| 63 | 63 | } |
| 64 | 64 | return $className; |
| 65 | 65 | } |
@@ -71,6 +71,6 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function setOptions() :array |
| 73 | 73 | { |
| 74 | - return []; |
|
| 74 | + return [ ]; |
|
| 75 | 75 | } |
| 76 | 76 | } |