@@ -76,8 +76,9 @@ discard block |
||
76 | 76 | { |
77 | 77 | $script = $this->resolve($id); |
78 | 78 | $deleted = $script->delete(); |
79 | - if ($deleted) |
|
80 | - event(new ScriptWasDeletedEvent($script)); |
|
79 | + if ($deleted) { |
|
80 | + event(new ScriptWasDeletedEvent($script)); |
|
81 | + } |
|
81 | 82 | return $deleted; |
82 | 83 | } |
83 | 84 | |
@@ -85,10 +86,11 @@ discard block |
||
85 | 86 | { |
86 | 87 | $script = $this->resolve($id); |
87 | 88 | $releases = $script->releases()->get(); |
88 | - if ($releases->isEmpty()) |
|
89 | - $lastVersion = "0.0.0"; |
|
90 | - else |
|
91 | - $lastVersion = $releases->last()->version; |
|
89 | + if ($releases->isEmpty()) { |
|
90 | + $lastVersion = "0.0.0"; |
|
91 | + } else { |
|
92 | + $lastVersion = $releases->last()->version; |
|
93 | + } |
|
92 | 94 | |
93 | 95 | $version = new Version($lastVersion); |
94 | 96 |
@@ -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; |
@@ -14,11 +14,11 @@ |
||
14 | 14 | use Modules\Authorization\Entities\Permission; |
15 | 15 | use Modules\Script\Permissions\ScriptPermission; |
16 | 16 | |
17 | -Route::get('/', 'ScriptController@index')->middleware(['permission:'.ScriptPermission::INDEX_SCRIPT]); |
|
18 | -Route::get('/{id}', 'ScriptController@show')->middleware(['permission:'.ScriptPermission::SHOW_SCRIPT]); |
|
19 | -Route::post('/', 'ScriptController@store')->middleware(['permission:'.ScriptPermission::CREATE_SCRIPT]); |
|
20 | -Route::patch('/{id}', 'ScriptController@update')->middleware(['permission:'.ScriptPermission::UPDATE_SCRIPT]); |
|
21 | -Route::delete('/{id}', 'ScriptController@destroy')->middleware(['permission:'.ScriptPermission::DELETE_SCRIPT]); |
|
17 | +Route::get('/', 'ScriptController@index')->middleware([ 'permission:'.ScriptPermission::INDEX_SCRIPT ]); |
|
18 | +Route::get('/{id}', 'ScriptController@show')->middleware([ 'permission:'.ScriptPermission::SHOW_SCRIPT ]); |
|
19 | +Route::post('/', 'ScriptController@store')->middleware([ 'permission:'.ScriptPermission::CREATE_SCRIPT ]); |
|
20 | +Route::patch('/{id}', 'ScriptController@update')->middleware([ 'permission:'.ScriptPermission::UPDATE_SCRIPT ]); |
|
21 | +Route::delete('/{id}', 'ScriptController@destroy')->middleware([ 'permission:'.ScriptPermission::DELETE_SCRIPT ]); |
|
22 | 22 | |
23 | 23 | |
24 | 24 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @param FindScriptRequest $request |
70 | 70 | * @param $id |
71 | 71 | */ |
72 | - public function show(FindScriptRequest $request ,$id) |
|
72 | + public function show(FindScriptRequest $request, $id) |
|
73 | 73 | { |
74 | 74 | $script = $this->service->resolve($id); |
75 | 75 |
@@ -35,12 +35,12 @@ |
||
35 | 35 | /** |
36 | 36 | * @var array |
37 | 37 | */ |
38 | - protected $guarded = []; |
|
38 | + protected $guarded = [ ]; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $casts = []; |
|
43 | + protected $casts = [ ]; |
|
44 | 44 | |
45 | 45 | protected $dates = [ |
46 | 46 | 'created_at', |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @var array |
29 | 29 | */ |
30 | - protected $guarded = []; |
|
30 | + protected $guarded = [ ]; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @var array |
34 | 34 | */ |
35 | - protected $casts = []; |
|
35 | + protected $casts = [ ]; |
|
36 | 36 | |
37 | 37 | protected $dates = [ |
38 | 38 | 'created_at', |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | 'deleted_at', |
41 | 41 | ]; |
42 | 42 | |
43 | - public function reply(){ |
|
43 | + public function reply() { |
|
44 | 44 | return $this->embedsOne(ScriptReviewReply::class); |
45 | 45 | } |
46 | 46 | |
47 | - public function script(){ |
|
47 | + public function script() { |
|
48 | 48 | return $this->belongsTo(Script::class); |
49 | 49 | } |
50 | 50 | |
51 | - public function user(){ |
|
51 | + public function user() { |
|
52 | 52 | return $this->belongsTo(User::class); |
53 | 53 | } |
54 | 54 | } |
@@ -40,37 +40,37 @@ |
||
40 | 40 | /** |
41 | 41 | * |
42 | 42 | */ |
43 | - public function generate(){ |
|
43 | + public function generate() { |
|
44 | 44 | |
45 | 45 | $this->moduleFactory->addModel($this->moduleName, true, true); |
46 | 46 | |
47 | - $this->moduleFactory->addService($this->moduleName . 'Service'); |
|
47 | + $this->moduleFactory->addService($this->moduleName.'Service'); |
|
48 | 48 | |
49 | - $this->moduleFactory->addController($this->moduleName . "Controller"); |
|
49 | + $this->moduleFactory->addController($this->moduleName."Controller"); |
|
50 | 50 | |
51 | - $this->moduleFactory->addTest($this->moduleName . 'ServiceTest', 'service'); |
|
52 | - $this->moduleFactory->addTest($this->moduleName . 'HttpTest', 'http'); |
|
53 | - $this->moduleFactory->addTest($this->moduleName . 'UnitTest', 'unit'); |
|
51 | + $this->moduleFactory->addTest($this->moduleName.'ServiceTest', 'service'); |
|
52 | + $this->moduleFactory->addTest($this->moduleName.'HttpTest', 'http'); |
|
53 | + $this->moduleFactory->addTest($this->moduleName.'UnitTest', 'unit'); |
|
54 | 54 | |
55 | - $this->moduleFactory->addEvent($this->moduleName . 'WasCreatedEvent'); |
|
56 | - $this->moduleFactory->addEvent($this->moduleName . 'WasUpdatedEvent'); |
|
57 | - $this->moduleFactory->addEvent($this->moduleName . 'WasDeletedEvent'); |
|
55 | + $this->moduleFactory->addEvent($this->moduleName.'WasCreatedEvent'); |
|
56 | + $this->moduleFactory->addEvent($this->moduleName.'WasUpdatedEvent'); |
|
57 | + $this->moduleFactory->addEvent($this->moduleName.'WasDeletedEvent'); |
|
58 | 58 | |
59 | - $this->moduleFactory->addRequest('Find'.$this->moduleName . 'Request'); |
|
60 | - $this->moduleFactory->addRequest('Index'.$this->moduleName . 'Request'); |
|
61 | - $this->moduleFactory->addRequest('Create'.$this->moduleName . 'Request'); |
|
62 | - $this->moduleFactory->addRequest('Update'.$this->moduleName . 'Request'); |
|
63 | - $this->moduleFactory->addRequest('Delete'.$this->moduleName . 'Request'); |
|
59 | + $this->moduleFactory->addRequest('Find'.$this->moduleName.'Request'); |
|
60 | + $this->moduleFactory->addRequest('Index'.$this->moduleName.'Request'); |
|
61 | + $this->moduleFactory->addRequest('Create'.$this->moduleName.'Request'); |
|
62 | + $this->moduleFactory->addRequest('Update'.$this->moduleName.'Request'); |
|
63 | + $this->moduleFactory->addRequest('Delete'.$this->moduleName.'Request'); |
|
64 | 64 | |
65 | - $this->moduleFactory->addPermission($this->moduleName . 'Permission'); |
|
65 | + $this->moduleFactory->addPermission($this->moduleName.'Permission'); |
|
66 | 66 | |
67 | - $this->moduleFactory->addPolicy($this->moduleName . 'Policy'); |
|
67 | + $this->moduleFactory->addPolicy($this->moduleName.'Policy'); |
|
68 | 68 | |
69 | 69 | $this->moduleFactory->addFactory($this->moduleName); |
70 | 70 | |
71 | 71 | $this->moduleFactory->addTransformer($this->moduleName.'Transformer', $this->moduleName); |
72 | 72 | |
73 | - $this->moduleFactory->addServiceProvider($this->moduleName . 'ServiceProvider'); |
|
73 | + $this->moduleFactory->addServiceProvider($this->moduleName.'ServiceProvider'); |
|
74 | 74 | |
75 | 75 | $this->moduleFactory->addRoute('v1'); |
76 | 76 |
@@ -71,20 +71,20 @@ |
||
71 | 71 | $this->info("Don't forget to add permissions to the Permission model!"); |
72 | 72 | } |
73 | 73 | |
74 | - protected function handleVersioningOption($shortcut, $type, $question, $default){ |
|
75 | - return $this->anticipate('What is the version of the route?',['v1','v2','v3','v4','v5'],$default); |
|
74 | + protected function handleVersioningOption($shortcut, $type, $question, $default) { |
|
75 | + return $this->anticipate('What is the version of the route?', [ 'v1', 'v2', 'v3', 'v4', 'v5' ], $default); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | protected function setOptions(): array |
79 | 79 | { |
80 | 80 | return [ |
81 | - ['versioning', null, InputOption::VALUE_OPTIONAL, 'The route version', 'v1'], |
|
81 | + [ 'versioning', null, InputOption::VALUE_OPTIONAL, 'The route version', 'v1' ], |
|
82 | 82 | ]; |
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function getFileName() :string |
86 | 86 | { |
87 | - return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion() . '.php'; |
|
87 | + return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion().'.php'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $type = $this->getType(); |
75 | 75 | |
76 | 76 | if (in_array($type, $this->types)) |
77 | - return "test-" . $type . ".stub"; |
|
77 | + return "test-".$type.".stub"; |
|
78 | 78 | |
79 | 79 | throw new Exception("Test type not supported"); |
80 | 80 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | protected function setOptions(): array |
88 | 88 | { |
89 | 89 | return [ |
90 | - ['type', $this->types, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.', $this->types[0]] |
|
90 | + [ 'type', $this->types, InputOption::VALUE_OPTIONAL, 'Indicates the type of the test.', $this->types[ 0 ] ] |
|
91 | 91 | ]; |
92 | 92 | } |
93 | 93 |
@@ -73,8 +73,9 @@ |
||
73 | 73 | { |
74 | 74 | $type = $this->getType(); |
75 | 75 | |
76 | - if (in_array($type, $this->types)) |
|
77 | - return "test-" . $type . ".stub"; |
|
76 | + if (in_array($type, $this->types)) { |
|
77 | + return "test-" . $type . ".stub"; |
|
78 | + } |
|
78 | 79 | |
79 | 80 | throw new Exception("Test type not supported"); |
80 | 81 | } |
@@ -35,12 +35,12 @@ |
||
35 | 35 | /** |
36 | 36 | * @var array |
37 | 37 | */ |
38 | - protected $guarded = []; |
|
38 | + protected $guarded = [ ]; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $casts = []; |
|
43 | + protected $casts = [ ]; |
|
44 | 44 | |
45 | 45 | protected $dates = [ |
46 | 46 | 'created_at', |