@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'TABLE' => 'users' |
51 | 51 | ]; |
52 | 52 | |
53 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedDirectoryPath, $expectedStubName, $expectedStubOptions) { |
|
53 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedDirectoryPath, $expectedStubName, $expectedStubOptions) { |
|
54 | 54 | $this->assertStringContainsString($expectedDirectoryPath, $event->getFilePath()); |
55 | 55 | $this->assertEquals($expectedStubName, $event->getStubName()); |
56 | 56 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function testCreateMongoMigration() |
62 | 62 | { |
63 | 63 | GeneratorManager::createMigration("User", "CreateUserCollection", 'users', true); |
64 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) { |
|
64 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) { |
|
65 | 65 | $this->assertEquals("migration-mongo.stub", $event->getStubName()); |
66 | 66 | return true; |
67 | 67 | }); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $moduleName = "User"; |
73 | 73 | GeneratorManager::createFactory($moduleName, "User"); |
74 | 74 | |
75 | - $expectedFileName = Larapi::getModule($moduleName)->getFactories()->getPath() . '/UserFactory.php'; |
|
75 | + $expectedFileName = Larapi::getModule($moduleName)->getFactories()->getPath().'/UserFactory.php'; |
|
76 | 76 | $expectedStubName = "factory.stub"; |
77 | 77 | $expectedStubOptions = [ |
78 | 78 | 'CLASS' => 'UserFactory', |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'MODEL_NAMESPACE' => 'Modules\User\Entities\User' |
81 | 81 | ]; |
82 | 82 | |
83 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
83 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
84 | 84 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
85 | 85 | $this->assertEquals($expectedStubName, $event->getStubName()); |
86 | 86 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | $moduleName = "User"; |
94 | 94 | GeneratorManager::createController($moduleName, "UserController"); |
95 | 95 | |
96 | - $expectedFileName = Larapi::getModule($moduleName)->getControllers()->getPath() . '/UserController.php'; |
|
96 | + $expectedFileName = Larapi::getModule($moduleName)->getControllers()->getPath().'/UserController.php'; |
|
97 | 97 | $expectedStubName = "controller.stub"; |
98 | 98 | $expectedStubOptions = [ |
99 | 99 | 'CLASS' => 'UserController', |
100 | 100 | 'NAMESPACE' => 'Modules\User\Http\Controllers' |
101 | 101 | ]; |
102 | 102 | |
103 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
103 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
104 | 104 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
105 | 105 | $this->assertEquals($expectedStubName, $event->getStubName()); |
106 | 106 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $moduleName = "User"; |
114 | 114 | GeneratorManager::createListener($moduleName, "SendWelcomeMail", "UserRegisteredEvent"); |
115 | 115 | |
116 | - $expectedFileName = Larapi::getModule($moduleName)->getListeners()->getPath() . '/SendWelcomeMail.php'; |
|
116 | + $expectedFileName = Larapi::getModule($moduleName)->getListeners()->getPath().'/SendWelcomeMail.php'; |
|
117 | 117 | $expectedStubName = "listener.stub"; |
118 | 118 | $expectedStubOptions = [ |
119 | 119 | 'CLASS' => 'SendWelcomeMail', |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'SHORTEVENTNAME' => 'UserRegisteredEvent', |
123 | 123 | ]; |
124 | 124 | |
125 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
125 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
126 | 126 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
127 | 127 | $this->assertEquals($expectedStubName, $event->getStubName()); |
128 | 128 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function testCreateQueuedListener() |
134 | 134 | { |
135 | 135 | GeneratorManager::createListener("User", "SendWelcomeMail", "UserRegisteredEvent", true); |
136 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) { |
|
136 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) { |
|
137 | 137 | $this->assertEquals("listener-queued.stub", $event->getStubName()); |
138 | 138 | return true; |
139 | 139 | }); |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $fileName = "RandomUserJob"; |
146 | 146 | GeneratorManager::createJob($moduleName, $fileName, false); |
147 | 147 | |
148 | - $expectedFileName = Larapi::getModule($moduleName)->getJobs()->getPath() . "/$fileName.php"; |
|
148 | + $expectedFileName = Larapi::getModule($moduleName)->getJobs()->getPath()."/$fileName.php"; |
|
149 | 149 | $expectedStubName = "job-queued.stub"; |
150 | 150 | $expectedStubOptions = [ |
151 | 151 | 'NAMESPACE' => 'Modules\User\Jobs', |
152 | 152 | 'CLASS' => 'RandomUserJob' |
153 | 153 | ]; |
154 | 154 | |
155 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
155 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
156 | 156 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
157 | 157 | $this->assertEquals($expectedStubName, $event->getStubName()); |
158 | 158 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | public function testCreateSynchronousJob() |
164 | 164 | { |
165 | 165 | GeneratorManager::createJob("User", "AJob", true); |
166 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) { |
|
166 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) { |
|
167 | 167 | $this->assertEquals("job.stub", $event->getStubName()); |
168 | 168 | return true; |
169 | 169 | }); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | GeneratorManager::createCommand($moduleName, $fileName, $commandName); |
179 | 179 | |
180 | - $expectedFileName = Larapi::getModule($moduleName)->getCommands()->getPath() . "/$fileName.php"; |
|
180 | + $expectedFileName = Larapi::getModule($moduleName)->getCommands()->getPath()."/$fileName.php"; |
|
181 | 181 | $expectedStubName = "command.stub"; |
182 | 182 | $expectedStubOptions = [ |
183 | 183 | 'NAMESPACE' => 'Modules\User\Console', |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'COMMAND_NAME' => $commandName |
186 | 186 | ]; |
187 | 187 | |
188 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
188 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
189 | 189 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
190 | 190 | $this->assertEquals($expectedStubName, $event->getStubName()); |
191 | 191 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | |
201 | 201 | GeneratorManager::createMiddleware($moduleName, $fileName); |
202 | 202 | |
203 | - $expectedFileName = Larapi::getModule($moduleName)->getMiddleWare()->getPath() . "/$fileName.php"; |
|
203 | + $expectedFileName = Larapi::getModule($moduleName)->getMiddleWare()->getPath()."/$fileName.php"; |
|
204 | 204 | $expectedStubName = "middleware.stub"; |
205 | 205 | $expectedStubOptions = [ |
206 | 206 | 'CLASS' => 'RandomMiddleware', |
207 | 207 | 'NAMESPACE' => 'Modules\User\Http\Middleware' |
208 | 208 | ]; |
209 | 209 | |
210 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
210 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
211 | 211 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
212 | 212 | $this->assertEquals($expectedStubName, $event->getStubName()); |
213 | 213 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -222,14 +222,14 @@ discard block |
||
222 | 222 | |
223 | 223 | GeneratorManager::createServiceProvider($moduleName, $fileName); |
224 | 224 | |
225 | - $expectedFileName = Larapi::getModule($moduleName)->getServiceProviders()->getPath() . "/$fileName.php"; |
|
225 | + $expectedFileName = Larapi::getModule($moduleName)->getServiceProviders()->getPath()."/$fileName.php"; |
|
226 | 226 | $expectedStubName = "provider.stub"; |
227 | 227 | $expectedStubOptions = [ |
228 | 228 | 'NAMESPACE' => 'Modules\User\Providers', |
229 | 229 | 'CLASS' => 'RandomServiceProvider' |
230 | 230 | ]; |
231 | 231 | |
232 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
232 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
233 | 233 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
234 | 234 | $this->assertEquals($expectedStubName, $event->getStubName()); |
235 | 235 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | |
245 | 245 | GeneratorManager::createNotification($moduleName, $fileName); |
246 | 246 | |
247 | - $expectedFileName = Larapi::getModule($moduleName)->getNotifications()->getPath() . "/$fileName.php"; |
|
247 | + $expectedFileName = Larapi::getModule($moduleName)->getNotifications()->getPath()."/$fileName.php"; |
|
248 | 248 | $expectedStubName = "notification.stub"; |
249 | 249 | $expectedStubOptions = [ |
250 | 250 | 'NAMESPACE' => 'Modules\User\Notifications', |
251 | 251 | 'CLASS' => 'RandomNotification' |
252 | 252 | ]; |
253 | 253 | |
254 | - Event::assertDispatched(FileGeneratedEvent::class, function (FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
254 | + Event::assertDispatched(FileGeneratedEvent::class, function(FileGeneratedEvent $event) use ($expectedFileName, $expectedStubName, $expectedStubOptions) { |
|
255 | 255 | $this->assertEquals($expectedFileName, $event->getFilePath()); |
256 | 256 | $this->assertEquals($expectedStubName, $event->getStubName()); |
257 | 257 | $this->assertEquals($expectedStubOptions, $event->getStubOptions()); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | GeneratorManager::createModel($moduleName, $fileName, false, true); |
268 | 268 | |
269 | - $expectedFileName = Larapi::getModule($moduleName)->getModels()->getPath() . "/$moduleName$fileName.php"; |
|
269 | + $expectedFileName = Larapi::getModule($moduleName)->getModels()->getPath()."/$moduleName$fileName.php"; |
|
270 | 270 | $expectedStubName = "model.stub"; |
271 | 271 | $expectedStubOptions = [ |
272 | 272 | 'NAMESPACE' => 'Modules\User\Entities', |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | GeneratorManager::createPolicy($moduleName, $fileName); |
301 | 301 | |
302 | - $expectedFileName = Larapi::getModule($moduleName)->getPolicies()->getPath() . "/$fileName.php"; |
|
302 | + $expectedFileName = Larapi::getModule($moduleName)->getPolicies()->getPath()."/$fileName.php"; |
|
303 | 303 | $expectedStubName = "policy.stub"; |
304 | 304 | $expectedStubOptions = [ |
305 | 305 | 'NAMESPACE' => 'Modules\User\Policies', |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | GeneratorManager::createTransformer($moduleName, $fileName, $model); |
323 | 323 | |
324 | - $expectedFileName = Larapi::getModule($moduleName)->getTransformers()->getPath() . "/$fileName.php"; |
|
324 | + $expectedFileName = Larapi::getModule($moduleName)->getTransformers()->getPath()."/$fileName.php"; |
|
325 | 325 | $expectedStubName = "transformer.stub"; |
326 | 326 | $expectedStubOptions = [ |
327 | 327 | 'NAMESPACE' => 'Modules\User\Transformers', |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | |
345 | 345 | GeneratorManager::createTest($moduleName, $fileName, 'unit'); |
346 | 346 | |
347 | - $expectedFileName = Larapi::getModule($moduleName)->getTests()->getPath() . "/$fileName.php"; |
|
347 | + $expectedFileName = Larapi::getModule($moduleName)->getTests()->getPath()."/$fileName.php"; |
|
348 | 348 | $expectedStubName = "unit-test.stub"; |
349 | 349 | $expectedStubOptions = [ |
350 | 350 | 'NAMESPACE' => 'Modules\User\Tests', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | GeneratorManager::createRequest($moduleName, $fileName); |
367 | 367 | |
368 | - $expectedFileName = Larapi::getModule($moduleName)->getRequests()->getPath() . "/$fileName.php"; |
|
368 | + $expectedFileName = Larapi::getModule($moduleName)->getRequests()->getPath()."/$fileName.php"; |
|
369 | 369 | $expectedStubName = "request.stub"; |
370 | 370 | $expectedStubOptions = [ |
371 | 371 | 'NAMESPACE' => 'Modules\User\Http\Requests', |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | GeneratorManager::createRule($moduleName, $fileName); |
388 | 388 | |
389 | - $expectedFileName = Larapi::getModule($moduleName)->getRules()->getPath() . "/$fileName.php"; |
|
389 | + $expectedFileName = Larapi::getModule($moduleName)->getRules()->getPath()."/$fileName.php"; |
|
390 | 390 | $expectedStubName = "rule.stub"; |
391 | 391 | $expectedStubOptions = [ |
392 | 392 | 'NAMESPACE' => 'Modules\User\Rules', |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | GeneratorManager::createSeeder($moduleName, $fileName); |
409 | 409 | |
410 | - $expectedFileName = Larapi::getModule($moduleName)->getSeeders()->getPath() . "/$fileName.php"; |
|
410 | + $expectedFileName = Larapi::getModule($moduleName)->getSeeders()->getPath()."/$fileName.php"; |
|
411 | 411 | $expectedStubName = "seeder.stub"; |
412 | 412 | $expectedStubOptions = [ |
413 | 413 | 'NAMESPACE' => 'Modules\User\Database\Seeders', |
@@ -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 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function getType(): string |
54 | 54 | { |
55 | - return once(function () { |
|
55 | + return once(function() { |
|
56 | 56 | $testType = $this->option('type') ?? $this->anticipate('What type of test would you like to create?', $this->types); |
57 | 57 | if ($testType === null) { |
58 | 58 | throw new Exception('type for test not specified'); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | protected function getOptions() |
84 | 84 | { |
85 | 85 | return [ |
86 | - ['type', null, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.'] |
|
86 | + [ 'type', null, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.' ] |
|
87 | 87 | ]; |
88 | 88 | } |
89 | 89 | } |
@@ -57,17 +57,17 @@ discard block |
||
57 | 57 | protected function getOptions() |
58 | 58 | { |
59 | 59 | return [ |
60 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', null], |
|
61 | - ['migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', null], |
|
60 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', null ], |
|
61 | + [ 'migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', null ], |
|
62 | 62 | ]; |
63 | 63 | } |
64 | 64 | |
65 | 65 | protected function isMongoModel(): bool |
66 | 66 | { |
67 | - return once(function () { |
|
67 | + return once(function() { |
|
68 | 68 | $option = $this->option('mongo'); |
69 | 69 | if ($option !== null) |
70 | - $option = (bool)$option; |
|
70 | + $option = (bool) $option; |
|
71 | 71 | |
72 | 72 | return $option === null ? $this->confirm('Is this model for a mongodb database?', false) : $option; |
73 | 73 | }); |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | if ($this->isMongoModel()) { |
80 | 80 | GeneratorManager::createMigration( |
81 | 81 | $this->getModuleName(), |
82 | - "Create" . ucfirst($this->getClassName()) . "Collection", |
|
82 | + "Create".ucfirst($this->getClassName())."Collection", |
|
83 | 83 | strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))), |
84 | 84 | true); |
85 | 85 | } else { |
86 | 86 | GeneratorManager::createMigration( |
87 | 87 | $this->getModuleName(), |
88 | - "Create" . ucfirst($this->getClassName() . "Table"), |
|
88 | + "Create".ucfirst($this->getClassName()."Table"), |
|
89 | 89 | strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))), |
90 | 90 | false); |
91 | 91 | } |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | if (strtolower($class) === strtolower($this->getModuleName())) { |
99 | 99 | return $class; |
100 | 100 | } |
101 | - return ucfirst($this->getModuleName()) . ucfirst($class); |
|
101 | + return ucfirst($this->getModuleName()).ucfirst($class); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | protected function needsMigration(): bool |
105 | 105 | { |
106 | - return once(function () { |
|
106 | + return once(function() { |
|
107 | 107 | $option = $this->option('migration'); |
108 | 108 | if ($option !== null) |
109 | - $option = (bool)$option; |
|
109 | + $option = (bool) $option; |
|
110 | 110 | |
111 | 111 | return $option === null ? $this->confirm('Do you want to create a migration for this model?', true) : $option; |
112 | 112 | }); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function getModelName(): string |
47 | 47 | { |
48 | - return once(function () { |
|
48 | + return once(function() { |
|
49 | 49 | return $this->option('model') ?? $this->anticipate('For what model would you like to generate a transformer?', Larapi::getModule($this->getModuleName())->getModels()->getAllPhpFileNamesWithoutExtension(), $this->getModuleName()); |
50 | 50 | }); |
51 | 51 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | protected function getOptions() |
69 | 69 | { |
70 | 70 | return [ |
71 | - ['model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null], |
|
71 | + [ 'model', null, InputOption::VALUE_OPTIONAL, 'The Model name for the transformer.', null ], |
|
72 | 72 | ]; |
73 | 73 | } |
74 | 74 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function getTableName(): string |
51 | 51 | { |
52 | - return once(function () { |
|
52 | + return once(function() { |
|
53 | 53 | return $this->option('table') ?? $this->ask('What is the name of the table/collection?', strtolower(Str::plural($this->getModuleName()))); |
54 | 54 | }); |
55 | 55 | } |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | protected function getOptions() |
63 | 63 | { |
64 | 64 | return [ |
65 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null], |
|
66 | - ['table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null], |
|
65 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null ], |
|
66 | + [ 'table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null ], |
|
67 | 67 | ]; |
68 | 68 | } |
69 | 69 | |
70 | 70 | protected function isMongoMigration(): bool |
71 | 71 | { |
72 | - return once(function () { |
|
72 | + return once(function() { |
|
73 | 73 | $option = $this->option('mongo'); |
74 | 74 | if ($option !== null) |
75 | - $option = (bool)$option; |
|
75 | + $option = (bool) $option; |
|
76 | 76 | |
77 | 77 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
78 | 78 | }); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected function getDestinationFilePath() |
97 | 97 | { |
98 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getDestinationFileName() . '.php'; |
|
98 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getDestinationFileName().'.php'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,6 +103,6 @@ discard block |
||
103 | 103 | */ |
104 | 104 | private function getDestinationFileName() |
105 | 105 | { |
106 | - return date('Y_m_d_His_') . split_caps_to_underscore($this->getClassName()); |
|
106 | + return date('Y_m_d_His_').split_caps_to_underscore($this->getClassName()); |
|
107 | 107 | } |
108 | 108 | } |
@@ -163,7 +163,7 @@ |
||
163 | 163 | \Artisan::call("larapi:make:command", $options); |
164 | 164 | } |
165 | 165 | |
166 | - public static function createModel(string $moduleName, string $modelName, bool $mongo=false, bool $migration = true) |
|
166 | + public static function createModel(string $moduleName, string $modelName, bool $mongo = false, bool $migration = true) |
|
167 | 167 | { |
168 | 168 | $options = [ |
169 | 169 | "module" => $moduleName, |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function getDestinationFilePath() |
46 | 46 | { |
47 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getFileName(); |
|
47 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getFileName(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function getTemplateContents() |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | { |
57 | 57 | $path = str_replace('\\', '/', $this->getDestinationFilePath()); |
58 | 58 | |
59 | - if (!$this->laravel['files']->isDirectory($dir = dirname($path))) { |
|
60 | - $this->laravel['files']->makeDirectory($dir, 0777, true); |
|
59 | + if (!$this->laravel[ 'files' ]->isDirectory($dir = dirname($path))) { |
|
60 | + $this->laravel[ 'files' ]->makeDirectory($dir, 0777, true); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if (file_exists($path) && !app()->environment('testing')) { |
@@ -80,26 +80,26 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function getFileName() |
82 | 82 | { |
83 | - return $this->getClassName() . '.php'; |
|
83 | + return $this->getClassName().'.php'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | protected function getModule(): Module |
87 | 87 | { |
88 | - return once(function () { |
|
88 | + return once(function() { |
|
89 | 89 | return Larapi::getModule($this->getModuleName()); |
90 | 90 | }); |
91 | 91 | } |
92 | 92 | |
93 | 93 | protected function getModuleName(): string |
94 | 94 | { |
95 | - return once(function () { |
|
95 | + return once(function() { |
|
96 | 96 | return Str::studly($this->askModuleName()); |
97 | 97 | }); |
98 | 98 | } |
99 | 99 | |
100 | 100 | private function askModuleName(): string |
101 | 101 | { |
102 | - $moduleName = $this->argument('module') ?? $this->anticipate('For what module would you like to generate a ' . $this->getGeneratorName() . '.', Larapi::getModuleNames()); |
|
102 | + $moduleName = $this->argument('module') ?? $this->anticipate('For what module would you like to generate a '.$this->getGeneratorName().'.', Larapi::getModuleNames()); |
|
103 | 103 | |
104 | 104 | if ($moduleName === null) { |
105 | 105 | throw new \Exception('Name of module not set.'); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getClassNamespace($module = null): string |
118 | 118 | { |
119 | - return $this->getModule()->getNamespace() . str_replace('/', '\\', $this->filePath); |
|
119 | + return $this->getModule()->getNamespace().str_replace('/', '\\', $this->filePath); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | |
133 | 133 | protected function getClassName(): string |
134 | 134 | { |
135 | - return once(function () { |
|
135 | + return once(function() { |
|
136 | 136 | return Str::studly($this->askClassName()); |
137 | 137 | }); |
138 | 138 | } |
139 | 139 | |
140 | 140 | private function askClassName(): string |
141 | 141 | { |
142 | - $className = $this->argument('name') ?? $this->ask('Specify the name of the ' . $this->getGeneratorName() . '.'); |
|
142 | + $className = $this->argument('name') ?? $this->ask('Specify the name of the '.$this->getGeneratorName().'.'); |
|
143 | 143 | |
144 | 144 | if ($className === null) { |
145 | - throw new \Exception('Name of ' . $this->getGeneratorName() . ' not set.'); |
|
145 | + throw new \Exception('Name of '.$this->getGeneratorName().' not set.'); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $className; |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | protected function getArguments() |
157 | 157 | { |
158 | 158 | return [ |
159 | - ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], |
|
160 | - ['name', InputArgument::OPTIONAL, 'The name of the ' . $this->getGeneratorName() . '.'], |
|
159 | + [ 'module', InputArgument::OPTIONAL, 'The name of module will be used.' ], |
|
160 | + [ 'name', InputArgument::OPTIONAL, 'The name of the '.$this->getGeneratorName().'.' ], |
|
161 | 161 | ]; |
162 | 162 | } |
163 | 163 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function getOptions() |
170 | 170 | { |
171 | - return []; |
|
171 | + return [ ]; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | protected function getGeneratorName(): string |