@@ -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 | } |
@@ -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 | } |
@@ -60,16 +60,16 @@ |
||
60 | 60 | protected function setOptions() :array |
61 | 61 | { |
62 | 62 | return [ |
63 | - ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.'], |
|
63 | + [ 'sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.' ], |
|
64 | 64 | ]; |
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function isJobSynchronous(): bool |
68 | 68 | { |
69 | - return once(function () { |
|
69 | + return once(function() { |
|
70 | 70 | $option = $this->option('sync'); |
71 | 71 | if ($option !== null) |
72 | - $option = (bool)$option; |
|
72 | + $option = (bool) $option; |
|
73 | 73 | |
74 | 74 | return $option === null ? $this->confirm('Should the job run Synchronously?', false) : $option; |
75 | 75 | }); |
@@ -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 | } |
@@ -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 | } |