@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | function get_module_path(string $module) |
| 5 | 5 | { |
| 6 | 6 | $module = ucfirst($module); |
| 7 | - $path = base_path('src/Modules') . '/' . $module; |
|
| 7 | + $path = base_path('src/Modules').'/'.$module; |
|
| 8 | 8 | if (file_exists($path)) { |
| 9 | 9 | return $path; |
| 10 | 10 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | $randomIndex = random_int(0, count($array) - 1); |
| 62 | 62 | |
| 63 | - return $array[$randomIndex]; |
|
| 63 | + return $array[ $randomIndex ]; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | if (!function_exists('create_multiple_from_factory')) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $traits = array_flip(class_uses_recursive($class)); |
| 111 | 111 | |
| 112 | - return isset($traits[$trait]); |
|
| 112 | + return isset($traits[ $trait ]); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | if (!function_exists('array_keys_exists')) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if (!function_exists('is_associative_array')) { |
| 154 | 154 | function is_associative_array(array $arr) |
| 155 | 155 | { |
| 156 | - if ([] === $arr) { |
|
| 156 | + if ([ ] === $arr) { |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $i = 0; |
| 233 | 233 | foreach ($splittedInCapsName as $word) { |
| 234 | 234 | if ($i !== 0) |
| 235 | - $splittedString = $splittedString . $word . '_'; |
|
| 235 | + $splittedString = $splittedString.$word.'_'; |
|
| 236 | 236 | $i++; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -231,8 +231,9 @@ |
||
| 231 | 231 | $splittedInCapsName = preg_split('/(?=[A-Z])/', $string); |
| 232 | 232 | $i = 0; |
| 233 | 233 | foreach ($splittedInCapsName as $word) { |
| 234 | - if ($i !== 0) |
|
| 235 | - $splittedString = $splittedString . $word . '_'; |
|
| 234 | + if ($i !== 0) { |
|
| 235 | + $splittedString = $splittedString . $word . '_'; |
|
| 236 | + } |
|
| 236 | 237 | $i++; |
| 237 | 238 | } |
| 238 | 239 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | public function testGetClassConstants() |
| 177 | 177 | { |
| 178 | 178 | $this->assertArrayHasKey('TEST_CONSTANT', get_class_constants(static::class)); |
| 179 | - $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)['TEST_CONSTANT']); |
|
| 179 | + $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)[ 'TEST_CONSTANT' ]); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function testInstanceWithoutConstructor() |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $this->assertInstanceOf(Larapi::class, instance_without_constructor(Larapi::class)); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function testSplitCapitalStringToUnderscores(){ |
|
| 187 | + public function testSplitCapitalStringToUnderscores() { |
|
| 188 | 188 | $this->assertEquals("proxy_uptime_collection", split_caps_to_underscore("ProxyUptimeCollection")); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -69,8 +69,9 @@ |
||
| 69 | 69 | { |
| 70 | 70 | $type = $this->getType(); |
| 71 | 71 | |
| 72 | - if (in_array($type, $this->types)) |
|
| 73 | - return "$type-test.stub"; |
|
| 72 | + if (in_array($type, $this->types)) { |
|
| 73 | + return "$type-test.stub"; |
|
| 74 | + } |
|
| 74 | 75 | |
| 75 | 76 | throw new Exception("Test type not supported"); |
| 76 | 77 | } |
@@ -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 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function getDispatchedEvents(?string $class): array |
| 23 | 23 | { |
| 24 | - $events = []; |
|
| 25 | - Event::assertDispatched($class, function ($event) use (&$events) { |
|
| 26 | - $events[] = $event; |
|
| 24 | + $events = [ ]; |
|
| 25 | + Event::assertDispatched($class, function($event) use (&$events) { |
|
| 26 | + $events[ ] = $event; |
|
| 27 | 27 | return true; |
| 28 | 28 | }); |
| 29 | 29 | return $events; |
@@ -38,6 +38,6 @@ discard block |
||
| 38 | 38 | $events = $this->getDispatchedEvents($class); |
| 39 | 39 | if (empty($events)) |
| 40 | 40 | return null; |
| 41 | - return $events[0]; |
|
| 41 | + return $events[ 0 ]; |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -36,8 +36,9 @@ |
||
| 36 | 36 | protected function getFirstDispatchedEvent(?string $class): ResourceGenerationContract |
| 37 | 37 | { |
| 38 | 38 | $events = $this->getDispatchedEvents($class); |
| 39 | - if (empty($events)) |
|
| 40 | - return null; |
|
| 39 | + if (empty($events)) { |
|
| 40 | + return null; |
|
| 41 | + } |
|
| 41 | 42 | return $events[0]; |
| 42 | 43 | } |
| 43 | 44 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | protected function getModelName(): string |
| 56 | 56 | { |
| 57 | - return once(function () { |
|
| 58 | - return $this->option('model') ?? $this->anticipate('For what model would you like to generate a factory?', [$this->getModuleName()], $this->getModuleName()); |
|
| 57 | + return once(function() { |
|
| 58 | + return $this->option('model') ?? $this->anticipate('For what model would you like to generate a factory?', [ $this->getModuleName() ], $this->getModuleName()); |
|
| 59 | 59 | }); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | protected function setOptions() :array |
| 82 | 82 | { |
| 83 | 83 | return [ |
| 84 | - ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null], |
|
| 84 | + [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the factory.', null ], |
|
| 85 | 85 | ]; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - protected function handleCommandOption($shortcut, $type, $question, $default){ |
|
| 89 | - return $this->anticipate('What is the name of the model?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(),Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[0]); |
|
| 88 | + protected function handleCommandOption($shortcut, $type, $question, $default) { |
|
| 89 | + return $this->anticipate('What is the name of the model?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension()[ 0 ]); |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | return [ |
| 51 | 51 | 'NAMESPACE' => $this->getClassNamespace(), |
| 52 | 52 | 'CLASS' => $this->getClassName(), |
| 53 | - 'EVENTNAME' => $this->getModule()->getNamespace() . '\\' . 'Events' . '\\' . $this->getEventName(), |
|
| 53 | + 'EVENTNAME' => $this->getModule()->getNamespace().'\\'.'Events'.'\\'.$this->getEventName(), |
|
| 54 | 54 | 'SHORTEVENTNAME' => $this->getEventName() |
| 55 | 55 | ]; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | protected function afterGeneration(): void |
| 59 | 59 | { |
| 60 | - $this->info("don't forget to add the listener to " . $this->getEventName()); |
|
| 60 | + $this->info("don't forget to add the listener to ".$this->getEventName()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | protected function setOptions(): array |
| 91 | 91 | { |
| 92 | 92 | return [ |
| 93 | - ['event', null, InputOption::VALUE_OPTIONAL, 'What is the name of the event that should be listened on?', null], |
|
| 94 | - ['queued', null, InputOption::VALUE_OPTIONAL, 'Should the listener be queued?', false], |
|
| 93 | + [ 'event', null, InputOption::VALUE_OPTIONAL, 'What is the name of the event that should be listened on?', null ], |
|
| 94 | + [ 'queued', null, InputOption::VALUE_OPTIONAL, 'Should the listener be queued?', false ], |
|
| 95 | 95 | ]; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -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 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | protected function getModelName(): string |
| 56 | 56 | { |
| 57 | - return once(function () { |
|
| 57 | + return once(function() { |
|
| 58 | 58 | return $this->option('model') ?? $this->anticipate('For what model would you like to generate a transformer?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), $this->getModuleName()); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | protected function setOptions() :array |
| 78 | 78 | { |
| 79 | 79 | return [ |
| 80 | - ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null], |
|
| 80 | + [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null ], |
|
| 81 | 81 | ]; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -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() |