@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->manager = $manager; |
| 34 | 34 | $this->model = $manager->model(); |
| 35 | 35 | |
| 36 | - if(!$this->model instanceof StatefulContract){ |
|
| 36 | + if (!$this->model instanceof StatefulContract) { |
|
| 37 | 37 | throw new \InvalidArgumentException('PublishAssistant requires the model to implement the StatefulContract.'); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function findAll(): Collection |
| 76 | 76 | { |
| 77 | - return $this->model->published()->get()->map(function ($model) { |
|
| 77 | + return $this->model->published()->get()->map(function($model) { |
|
| 78 | 78 | return $this->managers->findByModel($model); |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | private function guard($verb): Assistant |
| 98 | 98 | { |
| 99 | - if (! $this->can($verb)) { |
|
| 99 | + if (!$this->can($verb)) { |
|
| 100 | 100 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | $class = 'text-warning'; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $statusAsLabel = '<span class="font-bold '. $class .'"><em>' . $label . '</em></span>'; |
|
| 124 | + $statusAsLabel = '<span class="font-bold '.$class.'"><em>'.$label.'</em></span>'; |
|
| 125 | 125 | |
| 126 | 126 | if (!$plain && $this->hasPreviewUrl()) { |
| 127 | - $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>'; |
|
| 127 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return $statusAsLabel; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function isAssistedBy(string $assistantKey): bool |
| 19 | 19 | { |
| 20 | - return !! $this->getAssistantClass($assistantKey); |
|
| 20 | + return !!$this->getAssistantClass($assistantKey); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function assistant(string $assistantKey): Assistant |
| 52 | 52 | { |
| 53 | - if (! $this->isAssistedBy($assistantKey)) { |
|
| 54 | - throw new MissingAssistant('No assistant [' . $assistantKey . '] registered on manager ' . get_class($this)); |
|
| 53 | + if (!$this->isAssistedBy($assistantKey)) { |
|
| 54 | + throw new MissingAssistant('No assistant ['.$assistantKey.'] registered on manager '.get_class($this)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $instance = app($this->getAssistantClass($assistantKey)); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function addAssistant(string $assistantClass) |
| 86 | 86 | { |
| 87 | - if(false === array_search($assistantClass, $this->assistants)) { |
|
| 87 | + if (false === array_search($assistantClass, $this->assistants)) { |
|
| 88 | 88 | $this->assistants[] = $assistantClass; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $this->manager = $manager; |
| 32 | 32 | $this->model = $manager->model(); |
| 33 | 33 | |
| 34 | - if(!$this->model instanceof StatefulContract){ |
|
| 34 | + if (!$this->model instanceof StatefulContract) { |
|
| 35 | 35 | throw new \InvalidArgumentException('ArchiveAssistant requires the model to implement the StatefulContract.'); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function findAll(): Collection |
| 69 | 69 | { |
| 70 | - return $this->model->archived()->get()->map(function ($model) { |
|
| 70 | + return $this->model->archived()->get()->map(function($model) { |
|
| 71 | 71 | return $this->managers->findByModel($model); |
| 72 | 72 | }); |
| 73 | 73 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | private function guard($verb): Assistant |
| 99 | 99 | { |
| 100 | - if (! $this->can($verb)) { |
|
| 100 | + if (!$this->can($verb)) { |
|
| 101 | 101 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $registrations = collect($this->register->filterByTag($tag)->all()); |
| 52 | 52 | |
| 53 | - return $registrations->map(function ($registration) { |
|
| 53 | + return $registrations->map(function($registration) { |
|
| 54 | 54 | return $this->instance($registration); |
| 55 | 55 | }); |
| 56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $registrations = collect($this->register->filterByTag($tag)->all()); |
| 67 | 67 | |
| 68 | - return $registrations->map(function ($registration) { |
|
| 68 | + return $registrations->map(function($registration) { |
|
| 69 | 69 | return $this->instance($registration)->details(); |
| 70 | 70 | }); |
| 71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | //return array with group name and values |
| 77 | 77 | $grouped = []; |
| 78 | 78 | |
| 79 | - $managers = $managers->map(function (Manager $item) { |
|
| 79 | + $managers = $managers->map(function(Manager $item) { |
|
| 80 | 80 | return [ |
| 81 | 81 | 'id' => $item->details()->id, |
| 82 | 82 | 'group' => $item->details()->plural, |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $registrations = collect($this->register->all()); |
| 92 | 92 | |
| 93 | - return $registrations->map(function ($registration) { |
|
| 93 | + return $registrations->map(function($registration) { |
|
| 94 | 94 | return $this->instance($registration); |
| 95 | 95 | }); |
| 96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $assistants = collect(); |
| 101 | 101 | |
| 102 | - foreach($this->all() as $manager) { |
|
| 102 | + foreach ($this->all() as $manager) { |
|
| 103 | 103 | $assistants = $assistants->merge($manager->assistants(false)); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function anyRegisteredByTag($tag) |
| 110 | 110 | { |
| 111 | - return ! empty($this->register->filterByTag($tag)->all()); |
|
| 111 | + return !empty($this->register->filterByTag($tag)->all()); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | $this->manager = $manager; |
| 21 | 21 | $this->model = $manager->model(); |
| 22 | 22 | |
| 23 | - if(!$this->model instanceof StatefulContract){ |
|
| 24 | - throw new \InvalidArgumentException(static::class . ' requires the model to implement the ' . StatefulContract::class); |
|
| 23 | + if (!$this->model instanceof StatefulContract) { |
|
| 24 | + throw new \InvalidArgumentException(static::class.' requires the model to implement the '.StatefulContract::class); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function guard($verb): Assistant |
| 38 | 38 | { |
| 39 | - if (! $this->can($verb)) { |
|
| 39 | + if (!$this->can($verb)) { |
|
| 40 | 40 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -13,10 +13,10 @@ |
||
| 13 | 13 | |
| 14 | 14 | public static function register($app) |
| 15 | 15 | { |
| 16 | - Route::get('testje', [static::class, 'archive']); |
|
| 17 | - Route::get('testje', [AssistantController, 'archive']); |
|
| 16 | + Route::get('testje', [static::class, 'archive']); |
|
| 17 | + Route::get('testje', [AssistantController, 'archive']); |
|
| 18 | 18 | |
| 19 | - // fetched manager |
|
| 19 | + // fetched manager |
|
| 20 | 20 | // propagate naar assistant::archive |
| 21 | 21 | } |
| 22 | 22 | |