@@ -83,7 +83,7 @@ |
||
| 83 | 83 | |
| 84 | 84 | public function getStubOption(string $option) |
| 85 | 85 | { |
| 86 | - return $this->getStub()->getOptions()[strtoupper($option)] ?? null; |
|
| 86 | + return $this->getStub()->getOptions()[ strtoupper($option) ] ?? null; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class TransformerGeneratedEvent extends ResourceGeneratedEvent |
| 20 | 20 | { |
| 21 | - public function getModel(){ |
|
| 21 | + public function getModel() { |
|
| 22 | 22 | return $this->getStubOption("model"); |
| 23 | 23 | } |
| 24 | - public function getModelNamespace(){ |
|
| 24 | + public function getModelNamespace() { |
|
| 25 | 25 | return $this->getStubOption("model_namespace"); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | return $this->getStubOption("table"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function isMongoMigration(){ |
|
| 25 | + public function isMongoMigration() { |
|
| 26 | 26 | return $this->getStubOption("mongo"); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -18,15 +18,15 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ListenerGeneratedEvent extends ResourceGeneratedEvent |
| 20 | 20 | { |
| 21 | - public function getEvent(){ |
|
| 21 | + public function getEvent() { |
|
| 22 | 22 | return $this->getStubOption("event"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getEventNamespace(){ |
|
| 25 | + public function getEventNamespace() { |
|
| 26 | 26 | return $this->getStubOption("event_namespace"); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function isQueued(){ |
|
| 29 | + public function isQueued() { |
|
| 30 | 30 | return $this->getStubOption("queued"); |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ComposerGeneratedEvent extends ResourceGeneratedEvent |
| 20 | 20 | { |
| 21 | - public function getAuthorName(){ |
|
| 21 | + public function getAuthorName() { |
|
| 22 | 22 | return $this->getStubOption("author_name"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getAuthorMail(){ |
|
| 25 | + public function getAuthorMail() { |
|
| 26 | 26 | return $this->getStubOption("author_mail"); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class TestGeneratedEvent extends ResourceGeneratedEvent |
| 20 | 20 | { |
| 21 | - public function getType(){ |
|
| 21 | + public function getType() { |
|
| 22 | 22 | return $this->getStubOption("type"); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class RouteGeneratedEvent extends ResourceGeneratedEvent |
| 20 | 20 | { |
| 21 | - public function getVersion(){ |
|
| 21 | + public function getVersion() { |
|
| 22 | 22 | return $this->getStubOption("version"); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | return [ |
| 51 | 51 | 'NAMESPACE' => $this->getClassNamespace(), |
| 52 | 52 | 'CLASS' => $this->getClassName(), |
| 53 | - 'EVENT_NAMESPACE' => $this->getModule()->getNamespace() . '\\' . 'Events' . '\\' . $this->getEventName(), |
|
| 53 | + 'EVENT_NAMESPACE' => $this->getModule()->getNamespace().'\\'.'Events'.'\\'.$this->getEventName(), |
|
| 54 | 54 | 'EVENT' => $this->getEventName(), |
| 55 | 55 | 'QUEUED' => $this->needsQueing() |
| 56 | 56 | ]; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function afterGeneration(): void |
| 60 | 60 | { |
| 61 | - $this->info("don't forget to add the listener to " . $this->getEventName()); |
|
| 61 | + $this->info("don't forget to add the listener to ".$this->getEventName()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | protected function setOptions(): array |
| 92 | 92 | { |
| 93 | 93 | return [ |
| 94 | - ['event', null, InputOption::VALUE_OPTIONAL, 'What is the name of the event that should be listened on?', null], |
|
| 95 | - ['queued', null, InputOption::VALUE_OPTIONAL, 'Should the listener be queued?', false], |
|
| 94 | + [ 'event', null, InputOption::VALUE_OPTIONAL, 'What is the name of the event that should be listened on?', null ], |
|
| 95 | + [ 'queued', null, InputOption::VALUE_OPTIONAL, 'Should the listener be queued?', false ], |
|
| 96 | 96 | ]; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $this->assertEquals($stub, $event->getStub()->getName()); |
| 74 | 74 | $this->assertEquals($class, $event->getClassName()); |
| 75 | 75 | $this->assertEquals($table, $event->getTableName()); |
| 76 | - $this->assertEquals($mongo,$event->isMongoMigration()); |
|
| 76 | + $this->assertEquals($mongo, $event->isMongoMigration()); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function testCreateMongoMigration() |
@@ -94,19 +94,19 @@ discard block |
||
| 94 | 94 | $this->assertEquals($stub, $event->getStub()->getName()); |
| 95 | 95 | $this->assertEquals($class, $event->getClassName()); |
| 96 | 96 | $this->assertEquals($table, $event->getTableName()); |
| 97 | - $this->assertEquals($mongo,$event->isMongoMigration()); |
|
| 97 | + $this->assertEquals($mongo, $event->isMongoMigration()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function testCreateFactory() |
| 101 | 101 | { |
| 102 | 102 | $module = "User"; |
| 103 | 103 | $model = $module; |
| 104 | - $class = $model . "Factory"; |
|
| 104 | + $class = $model."Factory"; |
|
| 105 | 105 | $this->getModuleGenerator($module)->createFactory($module); |
| 106 | 106 | |
| 107 | - $path = Larapi::getModule($module)->getFactories()->getPath() . "/$class.php"; |
|
| 107 | + $path = Larapi::getModule($module)->getFactories()->getPath()."/$class.php"; |
|
| 108 | 108 | $stub = "factory.stub"; |
| 109 | - $modelNamespace = "Modules\User\Entities\User"; |
|
| 109 | + $modelNamespace = "Modules\User\Entities\User"; |
|
| 110 | 110 | |
| 111 | 111 | /* @var FactoryGeneratedEvent $event */ |
| 112 | 112 | $event = $this->getFirstDispatchedEvent(FactoryGeneratedEvent::class); |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | $module, |
| 116 | 116 | $stub, |
| 117 | 117 | $path); |
| 118 | - $this->assertEquals($class,$event->getClassName()); |
|
| 119 | - $this->assertEquals($model,$event->getModel()); |
|
| 120 | - $this->assertEquals($modelNamespace,$event->getModelNamespace()); |
|
| 118 | + $this->assertEquals($class, $event->getClassName()); |
|
| 119 | + $this->assertEquals($model, $event->getModel()); |
|
| 120 | + $this->assertEquals($modelNamespace, $event->getModelNamespace()); |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $class = "UserController"; |
| 128 | 128 | $this->getModuleGenerator($module)->createController($class); |
| 129 | 129 | |
| 130 | - $path = Larapi::getModule($module)->getControllers()->getPath() . "/$class.php"; |
|
| 130 | + $path = Larapi::getModule($module)->getControllers()->getPath()."/$class.php"; |
|
| 131 | 131 | $stub = "controller.stub"; |
| 132 | 132 | $namespace = "Modules\User\Http\Controllers"; |
| 133 | 133 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $queued = false; |
| 151 | 151 | $this->getModuleGenerator($module)->createListener($class, $eventClass, $queued); |
| 152 | 152 | |
| 153 | - $path = Larapi::getModule($module)->getListeners()->getPath() . '/SendWelcomeMail.php'; |
|
| 153 | + $path = Larapi::getModule($module)->getListeners()->getPath().'/SendWelcomeMail.php'; |
|
| 154 | 154 | $stub = "listener.stub"; |
| 155 | 155 | $namespace = "Modules\User\Listeners"; |
| 156 | 156 | $eventNamespace = "Modules\User\Events\UserRegisteredEvent"; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $queued = true; |
| 178 | 178 | $this->getModuleGenerator($module)->createListener($class, $eventClass, $queued); |
| 179 | 179 | |
| 180 | - $path = Larapi::getModule($module)->getListeners()->getPath() . '/SendWelcomeMail.php'; |
|
| 180 | + $path = Larapi::getModule($module)->getListeners()->getPath().'/SendWelcomeMail.php'; |
|
| 181 | 181 | $stub = "listener-queued.stub"; |
| 182 | 182 | $namespace = "Modules\User\Listeners"; |
| 183 | 183 | $eventNamespace = "Modules\User\Events\UserRegisteredEvent"; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $this->getModuleGenerator($module)->createJob($class, $synchronous); |
| 206 | 206 | |
| 207 | - $path = Larapi::getModule($module)->getJobs()->getPath() . "/$class.php"; |
|
| 207 | + $path = Larapi::getModule($module)->getJobs()->getPath()."/$class.php"; |
|
| 208 | 208 | $stub = "job-queued.stub"; |
| 209 | 209 | $namespace = "Modules\User\Jobs"; |
| 210 | 210 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | $this->getModuleGenerator($module)->createJob($class, $synchronous); |
| 230 | 230 | |
| 231 | - $path = Larapi::getModule($module)->getJobs()->getPath() . "/$class.php"; |
|
| 231 | + $path = Larapi::getModule($module)->getJobs()->getPath()."/$class.php"; |
|
| 232 | 232 | $stub = "job.stub"; |
| 233 | 233 | $namespace = "Modules\User\Jobs"; |
| 234 | 234 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $this->getModuleGenerator($module)->createCommand($class, $consoleCommand); |
| 254 | 254 | |
| 255 | - $path = Larapi::getModule($module)->getCommands()->getPath() . "/$class.php"; |
|
| 255 | + $path = Larapi::getModule($module)->getCommands()->getPath()."/$class.php"; |
|
| 256 | 256 | $stub = "command.stub"; |
| 257 | 257 | $namespace = "Modules\User\Console"; |
| 258 | 258 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | $this->getModuleGenerator($module)->createMiddleware($class); |
| 278 | 278 | |
| 279 | - $path = Larapi::getModule($module)->getMiddleWare()->getPath() . "/$class.php"; |
|
| 279 | + $path = Larapi::getModule($module)->getMiddleWare()->getPath()."/$class.php"; |
|
| 280 | 280 | $stub = "middleware.stub"; |
| 281 | 281 | $namespace = "Modules\User\Http\Middleware"; |
| 282 | 282 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $this->getModuleGenerator($module)->createServiceProvider($class); |
| 300 | 300 | |
| 301 | - $path = Larapi::getModule($module)->getServiceProviders()->getPath() . "/$class.php"; |
|
| 301 | + $path = Larapi::getModule($module)->getServiceProviders()->getPath()."/$class.php"; |
|
| 302 | 302 | $stub = "provider.stub"; |
| 303 | 303 | $namespace = "Modules\User\Providers"; |
| 304 | 304 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $this->getModuleGenerator($module)->createService($class); |
| 322 | 322 | |
| 323 | - $path = Larapi::getModule($module)->getServices()->getPath() . "/$class.php"; |
|
| 323 | + $path = Larapi::getModule($module)->getServices()->getPath()."/$class.php"; |
|
| 324 | 324 | $stub = "service.stub"; |
| 325 | 325 | $namespace = "Modules\User\Services"; |
| 326 | 326 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $this->getModuleGenerator($module)->createNotification($class); |
| 344 | 344 | |
| 345 | - $path = Larapi::getModule($module)->getNotifications()->getPath() . "/$class.php"; |
|
| 345 | + $path = Larapi::getModule($module)->getNotifications()->getPath()."/$class.php"; |
|
| 346 | 346 | $stub = "notification.stub"; |
| 347 | 347 | $namespace = "Modules\User\Notifications"; |
| 348 | 348 | |
@@ -361,13 +361,13 @@ discard block |
||
| 361 | 361 | { |
| 362 | 362 | $module = "User"; |
| 363 | 363 | $modelName = "Address"; |
| 364 | - $class = $module . $modelName; |
|
| 364 | + $class = $module.$modelName; |
|
| 365 | 365 | $needsMigration = true; |
| 366 | 366 | $isMongoModel = false; |
| 367 | 367 | |
| 368 | 368 | $this->getModuleGenerator($module)->createModel($class, $isMongoModel, $needsMigration); |
| 369 | 369 | |
| 370 | - $path = Larapi::getModule($module)->getModels()->getPath() . "/$module$modelName.php"; |
|
| 370 | + $path = Larapi::getModule($module)->getModels()->getPath()."/$module$modelName.php"; |
|
| 371 | 371 | $stub = "model.stub"; |
| 372 | 372 | $namespace = "Modules\User\Entities"; |
| 373 | 373 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $this->getModuleGenerator($module)->createPolicy($class); |
| 403 | 403 | |
| 404 | - $path = Larapi::getModule($module)->getPolicies()->getPath() . "/$class.php"; |
|
| 404 | + $path = Larapi::getModule($module)->getPolicies()->getPath()."/$class.php"; |
|
| 405 | 405 | $stub = "policy.stub"; |
| 406 | 406 | $namespace = "Modules\User\Policies"; |
| 407 | 407 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $this->getModuleGenerator($module)->createTransformer($class, $model); |
| 426 | 426 | |
| 427 | - $path = Larapi::getModule($module)->getTransformers()->getPath() . "/$class.php"; |
|
| 427 | + $path = Larapi::getModule($module)->getTransformers()->getPath()."/$class.php"; |
|
| 428 | 428 | $stub = "transformer.stub"; |
| 429 | 429 | $namespace = "Modules\User\Transformers"; |
| 430 | 430 | $modelNamespace = "Modules\User\Entities\User"; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | $this->getModuleGenerator($module)->createTest($class, 'unit'); |
| 451 | 451 | |
| 452 | - $path = Larapi::getModule($module)->getTests()->getPath() . "/$class.php"; |
|
| 452 | + $path = Larapi::getModule($module)->getTests()->getPath()."/$class.php"; |
|
| 453 | 453 | $stub = "unit-test.stub"; |
| 454 | 454 | $namespace = "Modules\User\Tests"; |
| 455 | 455 | $type = "unit"; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | $this->getModuleGenerator($module)->createRequest($class); |
| 475 | 475 | |
| 476 | - $path = Larapi::getModule($module)->getRequests()->getPath() . "/$class.php"; |
|
| 476 | + $path = Larapi::getModule($module)->getRequests()->getPath()."/$class.php"; |
|
| 477 | 477 | $stub = "request.stub"; |
| 478 | 478 | $namespace = "Modules\User\Http\Requests"; |
| 479 | 479 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | $this->getModuleGenerator($module)->createRule($fileName); |
| 497 | 497 | |
| 498 | - $path = Larapi::getModule($module)->getRules()->getPath() . "/$fileName.php"; |
|
| 498 | + $path = Larapi::getModule($module)->getRules()->getPath()."/$fileName.php"; |
|
| 499 | 499 | $stub = "rule.stub"; |
| 500 | 500 | $class = "BlalkaRule"; |
| 501 | 501 | $namespace = "Modules\User\Rules"; |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | $this->getModuleGenerator($module)->createSeeder($class); |
| 520 | 520 | |
| 521 | - $path = Larapi::getModule($module)->getSeeders()->getPath() . "/$class.php"; |
|
| 521 | + $path = Larapi::getModule($module)->getSeeders()->getPath()."/$class.php"; |
|
| 522 | 522 | $stub = "seeder.stub"; |
| 523 | 523 | $namespace = "Modules\User\Database\Seeders"; |
| 524 | 524 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | $this->getModuleGenerator($module)->createPermission($class); |
| 542 | 542 | |
| 543 | - $path = Larapi::getModule($module)->getPermissions()->getPath() . "/$class.php"; |
|
| 543 | + $path = Larapi::getModule($module)->getPermissions()->getPath()."/$class.php"; |
|
| 544 | 544 | $stub = "permission.stub"; |
| 545 | 545 | $namespace = "Modules\User\Permissions"; |
| 546 | 546 | |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | public function testCreateRoute() |
| 559 | 559 | { |
| 560 | 560 | $moduleName = "Demo"; |
| 561 | - $routename = strtolower(Str::plural($moduleName)) . '.v1'; |
|
| 561 | + $routename = strtolower(Str::plural($moduleName)).'.v1'; |
|
| 562 | 562 | |
| 563 | 563 | $this->getModuleGenerator($moduleName)->createRoute(); |
| 564 | 564 | |
| 565 | - $expectedFileName = Larapi::getModule($moduleName)->getRoutes()->getPath() . "/$routename.php"; |
|
| 565 | + $expectedFileName = Larapi::getModule($moduleName)->getRoutes()->getPath()."/$routename.php"; |
|
| 566 | 566 | $expectedStubName = "route.stub"; |
| 567 | 567 | $expectedVersion = "v1"; |
| 568 | 568 | |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | $this->getModuleGenerator($moduleName)->createComposer(); |
| 583 | 583 | |
| 584 | - $expectedFileName = Larapi::getModule($moduleName)->getPath() . "/composer.json"; |
|
| 584 | + $expectedFileName = Larapi::getModule($moduleName)->getPath()."/composer.json"; |
|
| 585 | 585 | $expectedStubName = "composer.stub"; |
| 586 | 586 | $authorName = 'arthur devious'; |
| 587 | 587 | $authorMail = '[email protected]'; |