@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->assertEquals($stub, $event->getStub()->getName()); |
| 76 | 76 | $this->assertEquals($class, $event->getClassName()); |
| 77 | 77 | $this->assertEquals($table, $event->getTableName()); |
| 78 | - $this->assertEquals($mongo,$event->isMongoMigration()); |
|
| 78 | + $this->assertEquals($mongo, $event->isMongoMigration()); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function testCreateMongoMigration() |
@@ -96,19 +96,19 @@ discard block |
||
| 96 | 96 | $this->assertEquals($stub, $event->getStub()->getName()); |
| 97 | 97 | $this->assertEquals($class, $event->getClassName()); |
| 98 | 98 | $this->assertEquals($table, $event->getTableName()); |
| 99 | - $this->assertEquals($mongo,$event->isMongoMigration()); |
|
| 99 | + $this->assertEquals($mongo, $event->isMongoMigration()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | public function testCreateFactory() |
| 103 | 103 | { |
| 104 | 104 | $module = "User"; |
| 105 | 105 | $model = $module; |
| 106 | - $class = $model . "Factory"; |
|
| 106 | + $class = $model."Factory"; |
|
| 107 | 107 | $this->getModuleGenerator($module)->createFactory($module); |
| 108 | 108 | |
| 109 | - $path = Larapi::getModule($module)->getFactories()->getPath() . "/$class.php"; |
|
| 109 | + $path = Larapi::getModule($module)->getFactories()->getPath()."/$class.php"; |
|
| 110 | 110 | $stub = "factory.stub"; |
| 111 | - $modelNamespace = "Modules\User\Entities\User"; |
|
| 111 | + $modelNamespace = "Modules\User\Entities\User"; |
|
| 112 | 112 | |
| 113 | 113 | /* @var FactoryGeneratedEvent $event */ |
| 114 | 114 | $event = $this->getFirstDispatchedEvent(FactoryGeneratedEvent::class); |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | $module, |
| 118 | 118 | $stub, |
| 119 | 119 | $path); |
| 120 | - $this->assertEquals($class,$event->getClassName()); |
|
| 121 | - $this->assertEquals($model,$event->getModel()); |
|
| 122 | - $this->assertEquals($modelNamespace,$event->getModelNamespace()); |
|
| 120 | + $this->assertEquals($class, $event->getClassName()); |
|
| 121 | + $this->assertEquals($model, $event->getModel()); |
|
| 122 | + $this->assertEquals($modelNamespace, $event->getModelNamespace()); |
|
| 123 | 123 | |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $class = "UserController"; |
| 130 | 130 | $this->getModuleGenerator($module)->createController($class); |
| 131 | 131 | |
| 132 | - $path = Larapi::getModule($module)->getControllers()->getPath() . "/$class.php"; |
|
| 132 | + $path = Larapi::getModule($module)->getControllers()->getPath()."/$class.php"; |
|
| 133 | 133 | $stub = "controller.stub"; |
| 134 | 134 | $namespace = "Modules\User\Http\Controllers"; |
| 135 | 135 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $class = "UserAttribute"; |
| 151 | 151 | $this->getModuleGenerator($module)->createAttribute($class); |
| 152 | 152 | |
| 153 | - $path = Larapi::getModule($module)->getAttributes()->getPath() . "/$class.php"; |
|
| 153 | + $path = Larapi::getModule($module)->getAttributes()->getPath()."/$class.php"; |
|
| 154 | 154 | $stub = "attribute.stub"; |
| 155 | 155 | $namespace = "Modules\User\Attributes"; |
| 156 | 156 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $class = "CreateUserData"; |
| 172 | 172 | $this->getModuleGenerator($module)->createDto($class); |
| 173 | 173 | |
| 174 | - $path = Larapi::getModule($module)->getDtos()->getPath() . "/$class.php"; |
|
| 174 | + $path = Larapi::getModule($module)->getDtos()->getPath()."/$class.php"; |
|
| 175 | 175 | $stub = "dto.stub"; |
| 176 | 176 | $namespace = "Modules\User\Dtos"; |
| 177 | 177 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $queued = false; |
| 195 | 195 | $this->getModuleGenerator($module)->createListener($class, $eventClass, $queued); |
| 196 | 196 | |
| 197 | - $path = Larapi::getModule($module)->getListeners()->getPath() . '/SendWelcomeMail.php'; |
|
| 197 | + $path = Larapi::getModule($module)->getListeners()->getPath().'/SendWelcomeMail.php'; |
|
| 198 | 198 | $stub = "listener.stub"; |
| 199 | 199 | $namespace = "Modules\User\Listeners"; |
| 200 | 200 | $eventNamespace = "Modules\User\Events\UserRegisteredEvent"; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $queued = true; |
| 222 | 222 | $this->getModuleGenerator($module)->createListener($class, $eventClass, $queued); |
| 223 | 223 | |
| 224 | - $path = Larapi::getModule($module)->getListeners()->getPath() . '/SendWelcomeMail.php'; |
|
| 224 | + $path = Larapi::getModule($module)->getListeners()->getPath().'/SendWelcomeMail.php'; |
|
| 225 | 225 | $stub = "listener-queued.stub"; |
| 226 | 226 | $namespace = "Modules\User\Listeners"; |
| 227 | 227 | $eventNamespace = "Modules\User\Events\UserRegisteredEvent"; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $this->getModuleGenerator($module)->createJob($class, $synchronous); |
| 250 | 250 | |
| 251 | - $path = Larapi::getModule($module)->getJobs()->getPath() . "/$class.php"; |
|
| 251 | + $path = Larapi::getModule($module)->getJobs()->getPath()."/$class.php"; |
|
| 252 | 252 | $stub = "job-queued.stub"; |
| 253 | 253 | $namespace = "Modules\User\Jobs"; |
| 254 | 254 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $this->getModuleGenerator($module)->createJob($class, $synchronous); |
| 274 | 274 | |
| 275 | - $path = Larapi::getModule($module)->getJobs()->getPath() . "/$class.php"; |
|
| 275 | + $path = Larapi::getModule($module)->getJobs()->getPath()."/$class.php"; |
|
| 276 | 276 | $stub = "job.stub"; |
| 277 | 277 | $namespace = "Modules\User\Jobs"; |
| 278 | 278 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $this->getModuleGenerator($module)->createCommand($class, $consoleCommand); |
| 298 | 298 | |
| 299 | - $path = Larapi::getModule($module)->getCommands()->getPath() . "/$class.php"; |
|
| 299 | + $path = Larapi::getModule($module)->getCommands()->getPath()."/$class.php"; |
|
| 300 | 300 | $stub = "command.stub"; |
| 301 | 301 | $namespace = "Modules\User\Console"; |
| 302 | 302 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $this->getModuleGenerator($module)->createMiddleware($class); |
| 322 | 322 | |
| 323 | - $path = Larapi::getModule($module)->getMiddleWare()->getPath() . "/$class.php"; |
|
| 323 | + $path = Larapi::getModule($module)->getMiddleWare()->getPath()."/$class.php"; |
|
| 324 | 324 | $stub = "middleware.stub"; |
| 325 | 325 | $namespace = "Modules\User\Http\Middleware"; |
| 326 | 326 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $this->getModuleGenerator($module)->createServiceProvider($class); |
| 344 | 344 | |
| 345 | - $path = Larapi::getModule($module)->getServiceProviders()->getPath() . "/$class.php"; |
|
| 345 | + $path = Larapi::getModule($module)->getServiceProviders()->getPath()."/$class.php"; |
|
| 346 | 346 | $stub = "provider.stub"; |
| 347 | 347 | $namespace = "Modules\User\Providers"; |
| 348 | 348 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | $this->getModuleGenerator($module)->createService($class); |
| 366 | 366 | |
| 367 | - $path = Larapi::getModule($module)->getServices()->getPath() . "/$class.php"; |
|
| 367 | + $path = Larapi::getModule($module)->getServices()->getPath()."/$class.php"; |
|
| 368 | 368 | $stub = "service.stub"; |
| 369 | 369 | $namespace = "Modules\User\Services"; |
| 370 | 370 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $this->getModuleGenerator($module)->createNotification($class); |
| 388 | 388 | |
| 389 | - $path = Larapi::getModule($module)->getNotifications()->getPath() . "/$class.php"; |
|
| 389 | + $path = Larapi::getModule($module)->getNotifications()->getPath()."/$class.php"; |
|
| 390 | 390 | $stub = "notification.stub"; |
| 391 | 391 | $namespace = "Modules\User\Notifications"; |
| 392 | 392 | |
@@ -405,13 +405,13 @@ discard block |
||
| 405 | 405 | { |
| 406 | 406 | $module = "User"; |
| 407 | 407 | $modelName = "Address"; |
| 408 | - $class = $module . $modelName; |
|
| 408 | + $class = $module.$modelName; |
|
| 409 | 409 | $needsMigration = true; |
| 410 | 410 | $isMongoModel = false; |
| 411 | 411 | |
| 412 | 412 | $this->getModuleGenerator($module)->createModel($class, $isMongoModel, $needsMigration); |
| 413 | 413 | |
| 414 | - $path = Larapi::getModule($module)->getModels()->getPath() . "/$module$modelName.php"; |
|
| 414 | + $path = Larapi::getModule($module)->getModels()->getPath()."/$module$modelName.php"; |
|
| 415 | 415 | $stub = "model.stub"; |
| 416 | 416 | $namespace = "Modules\User\Entities"; |
| 417 | 417 | |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | $this->getModuleGenerator($module)->createPolicy($class); |
| 447 | 447 | |
| 448 | - $path = Larapi::getModule($module)->getPolicies()->getPath() . "/$class.php"; |
|
| 448 | + $path = Larapi::getModule($module)->getPolicies()->getPath()."/$class.php"; |
|
| 449 | 449 | $stub = "policy.stub"; |
| 450 | 450 | $namespace = "Modules\User\Policies"; |
| 451 | 451 | |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | |
| 469 | 469 | $this->getModuleGenerator($module)->createTransformer($class, $model); |
| 470 | 470 | |
| 471 | - $path = Larapi::getModule($module)->getTransformers()->getPath() . "/$class.php"; |
|
| 471 | + $path = Larapi::getModule($module)->getTransformers()->getPath()."/$class.php"; |
|
| 472 | 472 | $stub = "transformer.stub"; |
| 473 | 473 | $namespace = "Modules\User\Transformers"; |
| 474 | 474 | $modelNamespace = "Modules\User\Entities\User"; |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | $this->getModuleGenerator($module)->createTest($class, 'unit'); |
| 495 | 495 | |
| 496 | - $path = Larapi::getModule($module)->getTests()->getPath() . "/$class.php"; |
|
| 496 | + $path = Larapi::getModule($module)->getTests()->getPath()."/$class.php"; |
|
| 497 | 497 | $stub = "test-unit.stub"; |
| 498 | 498 | $namespace = "Modules\User\Tests"; |
| 499 | 499 | $type = "unit"; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | $this->getModuleGenerator($module)->createRequest($class); |
| 519 | 519 | |
| 520 | - $path = Larapi::getModule($module)->getRequests()->getPath() . "/$class.php"; |
|
| 520 | + $path = Larapi::getModule($module)->getRequests()->getPath()."/$class.php"; |
|
| 521 | 521 | $stub = "request.stub"; |
| 522 | 522 | $namespace = "Modules\User\Http\Requests"; |
| 523 | 523 | |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | $this->getModuleGenerator($module)->createRule($fileName); |
| 541 | 541 | |
| 542 | - $path = Larapi::getModule($module)->getRules()->getPath() . "/$fileName.php"; |
|
| 542 | + $path = Larapi::getModule($module)->getRules()->getPath()."/$fileName.php"; |
|
| 543 | 543 | $stub = "rule.stub"; |
| 544 | 544 | $class = "BlalkaRule"; |
| 545 | 545 | $namespace = "Modules\User\Rules"; |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | $this->getModuleGenerator($module)->createSeeder($class); |
| 564 | 564 | |
| 565 | - $path = Larapi::getModule($module)->getSeeders()->getPath() . "/$class.php"; |
|
| 565 | + $path = Larapi::getModule($module)->getSeeders()->getPath()."/$class.php"; |
|
| 566 | 566 | $stub = "seeder.stub"; |
| 567 | 567 | $namespace = "Modules\User\Database\Seeders"; |
| 568 | 568 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | $this->getModuleGenerator($module)->createPermission($class); |
| 586 | 586 | |
| 587 | - $path = Larapi::getModule($module)->getPermissions()->getPath() . "/$class.php"; |
|
| 587 | + $path = Larapi::getModule($module)->getPermissions()->getPath()."/$class.php"; |
|
| 588 | 588 | $stub = "permission.stub"; |
| 589 | 589 | $namespace = "Modules\User\Permissions"; |
| 590 | 590 | |
@@ -603,11 +603,11 @@ discard block |
||
| 603 | 603 | { |
| 604 | 604 | $moduleName = "Demo"; |
| 605 | 605 | $version = 'v1'; |
| 606 | - $routename = strtolower(Str::plural($moduleName)) . ".$version"; |
|
| 606 | + $routename = strtolower(Str::plural($moduleName)).".$version"; |
|
| 607 | 607 | |
| 608 | 608 | $this->getModuleGenerator($moduleName)->createRoute($version); |
| 609 | 609 | |
| 610 | - $expectedFileName = Larapi::getModule($moduleName)->getRoutes()->getPath() . "/$routename.php"; |
|
| 610 | + $expectedFileName = Larapi::getModule($moduleName)->getRoutes()->getPath()."/$routename.php"; |
|
| 611 | 611 | $expectedStubName = "route.stub"; |
| 612 | 612 | $expectedVersion = "v1"; |
| 613 | 613 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | $this->getModuleGenerator($moduleName)->createComposer(); |
| 628 | 628 | |
| 629 | - $expectedFileName = Larapi::getModule($moduleName)->getPath() . "/composer.json"; |
|
| 629 | + $expectedFileName = Larapi::getModule($moduleName)->getPath()."/composer.json"; |
|
| 630 | 630 | $expectedStubName = "composer.stub"; |
| 631 | 631 | $authorName = 'arthur devious'; |
| 632 | 632 | $authorMail = '[email protected]'; |
@@ -28,9 +28,9 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function resolve() |
| 30 | 30 | { |
| 31 | - $guards = []; |
|
| 31 | + $guards = [ ]; |
|
| 32 | 32 | if (!is_array($this->guard)) { |
| 33 | - $guards[] = $this->guard; |
|
| 33 | + $guards[ ] = $this->guard; |
|
| 34 | 34 | } |
| 35 | 35 | else |
| 36 | 36 | $guards = $this->guard; |
@@ -31,13 +31,14 @@ |
||
| 31 | 31 | $guards = []; |
| 32 | 32 | if (!is_array($this->guard)) { |
| 33 | 33 | $guards[] = $this->guard; |
| 34 | + } else { |
|
| 35 | + $guards = $this->guard; |
|
| 34 | 36 | } |
| 35 | - else |
|
| 36 | - $guards = $this->guard; |
|
| 37 | 37 | |
| 38 | 38 | foreach ($guards as $guard) { |
| 39 | - if (!($guard instanceof GuardContract)) |
|
| 40 | - throw new UnexpectedTypeException($guard, GuardContract::class); |
|
| 39 | + if (!($guard instanceof GuardContract)) { |
|
| 40 | + throw new UnexpectedTypeException($guard, GuardContract::class); |
|
| 41 | + } |
|
| 41 | 42 | } |
| 42 | 43 | return $guards; |
| 43 | 44 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | /** |
| 24 | 24 | * @var GuardContract[] |
| 25 | 25 | */ |
| 26 | - protected $guards = []; |
|
| 26 | + protected $guards = [ ]; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @var Throwable|null |
@@ -45,10 +45,11 @@ |
||
| 45 | 45 | { |
| 46 | 46 | foreach ($this->guards as $guard) { |
| 47 | 47 | if ($guard->condition()) { |
| 48 | - if (isset($this->exception)) |
|
| 49 | - throw $this->exception; |
|
| 50 | - else |
|
| 51 | - throw $guard->exception(); |
|
| 48 | + if (isset($this->exception)) { |
|
| 49 | + throw $this->exception; |
|
| 50 | + } else { |
|
| 51 | + throw $guard->exception(); |
|
| 52 | + } |
|
| 52 | 53 | } |
| 53 | 54 | } |
| 54 | 55 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function create(array $data): Script |
| 67 | 67 | { |
| 68 | - $data[Script::AUTHOR_ID] = get_authenticated_user_id(); |
|
| 68 | + $data[ Script::AUTHOR_ID ] = get_authenticated_user_id(); |
|
| 69 | 69 | $script = Script::create($data); |
| 70 | 70 | event(new ScriptWasCreatedEvent($script)); |
| 71 | 71 | return $script; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $version = new Version($lastVersion); |
| 97 | 97 | |
| 98 | - switch ($data['type']) { |
|
| 98 | + switch ($data[ 'type' ]) { |
|
| 99 | 99 | case 'MAJOR': |
| 100 | 100 | $version->incrementMajor(); |
| 101 | 101 | break; |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | //TODO ADD CONFIG TEMPLATE |
| 113 | 113 | $script->releases()->create([ |
| 114 | 114 | ScriptRelease::VERSION => $version->__toString(), |
| 115 | - ScriptRelease::TYPE => $data['type'], |
|
| 116 | - ScriptRelease::CHANGELOG => $data['changelog'] |
|
| 115 | + ScriptRelease::TYPE => $data[ 'type' ], |
|
| 116 | + ScriptRelease::CHANGELOG => $data[ 'changelog' ] |
|
| 117 | 117 | ]); |
| 118 | 118 | |
| 119 | 119 | return $script; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $review = $script->reviews()->create([ |
| 132 | 132 | ScriptReview::REVIEWER_ID => get_authenticated_user_id(), |
| 133 | 133 | ScriptReview::VERSION => $script->releases->last()->version, |
| 134 | - ScriptReview::MESSAGE => $data['message'] |
|
| 134 | + ScriptReview::MESSAGE => $data[ 'message' ] |
|
| 135 | 135 | ]); |
| 136 | 136 | |
| 137 | 137 | return $review; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $script = $this->resolve($id); |
| 143 | 143 | |
| 144 | - $review = $script->reviews()->withTrashed()->find($data['review_id']); |
|
| 144 | + $review = $script->reviews()->withTrashed()->find($data[ 'review_id' ]); |
|
| 145 | 145 | |
| 146 | 146 | if (!isset($review)) { |
| 147 | 147 | throw new ScriptAlreadyReviewedException(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $reply = $review->reply()->create([ |
| 155 | 155 | ScriptReviewReply::REPLIER_ID => get_authenticated_user_id(), |
| 156 | - ScriptReviewReply::MESSAGE => $data['message'] |
|
| 156 | + ScriptReviewReply::MESSAGE => $data[ 'message' ] |
|
| 157 | 157 | ]); |
| 158 | 158 | |
| 159 | 159 | return $reply; |