@@ -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 |
@@ -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 | } |
@@ -100,7 +100,7 @@ |
||
100 | 100 | * @param $ability |
101 | 101 | * |
102 | 102 | * @return bool|null |
103 | - */ |
|
103 | + */ |
|
104 | 104 | public function before($user, $ability) |
105 | 105 | { |
106 | 106 | if ($user->isAdmin()) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function getClassName(): string |
55 | 55 | { |
56 | - return $this->getModelName() . 'Factory'; |
|
56 | + return $this->getModelName().'Factory'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | protected function stubOptions(): array |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | return [ |
62 | 62 | 'CLASS' => $this->getClassName(), |
63 | 63 | 'MODEL' => $this->getModelName(), |
64 | - 'MODEL_NAMESPACE' => $this->getModule()->getNamespace() . '\\' . 'Entities' . '\\' . $this->getModelName(), |
|
64 | + 'MODEL_NAMESPACE' => $this->getModule()->getNamespace().'\\'.'Entities'.'\\'.$this->getModelName(), |
|
65 | 65 | ]; |
66 | 66 | } |
67 | 67 | |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | protected function setOptions(): array |
74 | 74 | { |
75 | 75 | return [ |
76 | - ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null], |
|
76 | + [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null ], |
|
77 | 77 | ]; |
78 | 78 | } |
79 | 79 | |
80 | 80 | protected function handleModelOption($shortcut, $type, $question, $default) |
81 | 81 | { |
82 | - return $this->anticipate('For what model would you like to generate a factory?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[0] ?? ""); |
|
82 | + return $this->anticipate('For what model would you like to generate a factory?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[ 0 ] ?? ""); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function getModelName() :string |
@@ -52,7 +52,7 @@ |
||
52 | 52 | protected function getArguments() |
53 | 53 | { |
54 | 54 | return [ |
55 | - ['name', InputArgument::REQUIRED, 'The name of the module that will be created.'], |
|
55 | + [ 'name', InputArgument::REQUIRED, 'The name of the module that will be created.' ], |
|
56 | 56 | ]; |
57 | 57 | } |
58 | 58 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | protected function setOptions() :array |
72 | 72 | { |
73 | 73 | return [ |
74 | - ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null], |
|
74 | + [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null ], |
|
75 | 75 | ]; |
76 | 76 | } |
77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return $this->getOption("model"); |
81 | 81 | } |
82 | 82 | |
83 | - protected function handleModelOption(){ |
|
83 | + protected function handleModelOption() { |
|
84 | 84 | return $this->anticipate('For what model would you like to generate a transformer?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), $this->getModuleName()); |
85 | 85 | } |
86 | 86 | } |
@@ -40,37 +40,37 @@ |
||
40 | 40 | /** |
41 | 41 | * |
42 | 42 | */ |
43 | - public function generate(){ |
|
43 | + public function generate() { |
|
44 | 44 | |
45 | 45 | $this->moduleFactory->addModel($this->moduleName, true, true); |
46 | 46 | |
47 | - $this->moduleFactory->addService($this->moduleName . 'Service'); |
|
47 | + $this->moduleFactory->addService($this->moduleName.'Service'); |
|
48 | 48 | |
49 | - $this->moduleFactory->addController($this->moduleName . "Controller"); |
|
49 | + $this->moduleFactory->addController($this->moduleName."Controller"); |
|
50 | 50 | |
51 | - $this->moduleFactory->addTest($this->moduleName . 'ServiceTest', 'service'); |
|
52 | - $this->moduleFactory->addTest($this->moduleName . 'HttpTest', 'http'); |
|
53 | - $this->moduleFactory->addTest($this->moduleName . 'UnitTest', 'unit'); |
|
51 | + $this->moduleFactory->addTest($this->moduleName.'ServiceTest', 'service'); |
|
52 | + $this->moduleFactory->addTest($this->moduleName.'HttpTest', 'http'); |
|
53 | + $this->moduleFactory->addTest($this->moduleName.'UnitTest', 'unit'); |
|
54 | 54 | |
55 | - $this->moduleFactory->addEvent($this->moduleName . 'WasCreatedEvent'); |
|
56 | - $this->moduleFactory->addEvent($this->moduleName . 'WasUpdatedEvent'); |
|
57 | - $this->moduleFactory->addEvent($this->moduleName . 'WasDeletedEvent'); |
|
55 | + $this->moduleFactory->addEvent($this->moduleName.'WasCreatedEvent'); |
|
56 | + $this->moduleFactory->addEvent($this->moduleName.'WasUpdatedEvent'); |
|
57 | + $this->moduleFactory->addEvent($this->moduleName.'WasDeletedEvent'); |
|
58 | 58 | |
59 | - $this->moduleFactory->addRequest('Find'.$this->moduleName . 'Request'); |
|
60 | - $this->moduleFactory->addRequest('Index'.$this->moduleName . 'Request'); |
|
61 | - $this->moduleFactory->addRequest('Create'.$this->moduleName . 'Request'); |
|
62 | - $this->moduleFactory->addRequest('Update'.$this->moduleName . 'Request'); |
|
63 | - $this->moduleFactory->addRequest('Delete'.$this->moduleName . 'Request'); |
|
59 | + $this->moduleFactory->addRequest('Find'.$this->moduleName.'Request'); |
|
60 | + $this->moduleFactory->addRequest('Index'.$this->moduleName.'Request'); |
|
61 | + $this->moduleFactory->addRequest('Create'.$this->moduleName.'Request'); |
|
62 | + $this->moduleFactory->addRequest('Update'.$this->moduleName.'Request'); |
|
63 | + $this->moduleFactory->addRequest('Delete'.$this->moduleName.'Request'); |
|
64 | 64 | |
65 | - $this->moduleFactory->addPermission($this->moduleName . 'Permission'); |
|
65 | + $this->moduleFactory->addPermission($this->moduleName.'Permission'); |
|
66 | 66 | |
67 | - $this->moduleFactory->addPolicy($this->moduleName . 'Policy'); |
|
67 | + $this->moduleFactory->addPolicy($this->moduleName.'Policy'); |
|
68 | 68 | |
69 | 69 | $this->moduleFactory->addFactory($this->moduleName); |
70 | 70 | |
71 | 71 | $this->moduleFactory->addTransformer($this->moduleName.'Transformer', $this->moduleName); |
72 | 72 | |
73 | - $this->moduleFactory->addServiceProvider($this->moduleName . 'ServiceProvider'); |
|
73 | + $this->moduleFactory->addServiceProvider($this->moduleName.'ServiceProvider'); |
|
74 | 74 | |
75 | 75 | $this->moduleFactory->addRoute(); |
76 | 76 |