Test Setup Failed
Push — a-simpler-manager ( 9beba5...d99f82 )
by Ben
06:26
created
src/Admin/HealthMonitor/Checks/HomepageSetCheck.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
     public function message(): string
18 18
     {
19
-        return 'Het lijkt erop dat er geen homepagina ingesteld is. Stel er een in hier: <a href="' . route('chief.back.settings.edit') . '" class="text-secondary-800 underline hover:text-white">Settings</a>';
19
+        return 'Het lijkt erop dat er geen homepagina ingesteld is. Stel er een in hier: <a href="'.route('chief.back.settings.edit').'" class="text-secondary-800 underline hover:text-white">Settings</a>';
20 20
     }
21 21
 
22 22
     public function notifiers(): array
Please login to merge, or discard this patch.
src/Managers/Routes/ManagedRoutes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
     public function push($managedRoutes): self
31 31
     {
32
-        return new static($this->managerClass, $this->prefix, array_merge($this->routes, (array) $managedRoutes));
32
+        return new static($this->managerClass, $this->prefix, array_merge($this->routes, (array)$managedRoutes));
33 33
     }
34 34
 
35 35
     public function getManagerClass(): string
Please login to merge, or discard this patch.
src/Managers/Routes/RegisterManagedRoutes.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
     {
29 29
         $managedRoutes = $this->expandWithAssistantRoutes($manager, $managedRoutes);
30 30
 
31
-        $this->router->group(['prefix' => $this->routePrefix, 'middleware' => $this->routeMiddleware], function () use($managedRoutes, $controllerClass) {
32
-            foreach($managedRoutes as $route) {
31
+        $this->router->group(['prefix' => $this->routePrefix, 'middleware' => $this->routeMiddleware], function() use($managedRoutes, $controllerClass) {
32
+            foreach ($managedRoutes as $route) {
33 33
                 $this->router->addRoute(
34 34
                     $route->method,
35
-                    $managedRoutes->getPrefix() .'/'. $route->uri,
35
+                    $managedRoutes->getPrefix().'/'.$route->uri,
36 36
                     [$controllerClass, Str::camel($route->action)]
37
-                )->name('chief.' . $managedRoutes->getPrefix() . '.' . $route->action);
37
+                )->name('chief.'.$managedRoutes->getPrefix().'.'.$route->action);
38 38
             }
39 39
         });
40 40
     }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             }
49 49
         }
50 50
 
51
-        if(public_method_exists($manager, 'routes')) {
51
+        if (public_method_exists($manager, 'routes')) {
52 52
             $managedRoutes = $managedRoutes->push($manager->routes());
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/Managers/Register/Registry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function modelClass(string $key): string
24 24
     {
25
-        if(!isset($this->models[$key])) {
25
+        if (!isset($this->models[$key])) {
26 26
             throw new MissingModelRegistration('No model class registered for key ['.$key.']');
27 27
         }
28 28
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function manager(string $key): Manager
33 33
     {
34
-        if(!isset($this->managers[$key])) {
34
+        if (!isset($this->managers[$key])) {
35 35
             throw new MissingManagerRegistration('No manager registered for key ['.$key.']');
36 36
         }
37 37
 
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function managersWithTags(): array
52 52
     {
53
-        return collect($this->tags->get())->reject(function($tags, $key){
53
+        return collect($this->tags->get())->reject(function($tags, $key) {
54 54
             return !isset($this->managers[$key]);
55
-        })->map(function($tags, $key){
55
+        })->map(function($tags, $key) {
56 56
             return (object)[
57 57
                 'manager' => $this->manager($key),
58 58
                 'tags' => $tags,
Please login to merge, or discard this patch.
src/Managers/Register/TaggedKeys.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function tagged($tags): self
23 23
     {
24
-        $tags = (array) $tags;
24
+        $tags = (array)$tags;
25 25
 
26 26
         return $this->filter(function($value, $key) use($tags){
27 27
             return count(array_intersect($value, $tags)) > 0;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function notTagged($tags): self
32 32
     {
33
-        $tags = (array) $tags;
33
+        $tags = (array)$tags;
34 34
 
35 35
         return $this->filter(function($value, $key) use($tags){
36 36
             return count(array_intersect($value, $tags)) === 0;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function untagged(): self
41 41
     {
42
-        return $this->filter(function($value){
42
+        return $this->filter(function($value) {
43 43
             return empty($value);
44 44
         });
45 45
     }
Please login to merge, or discard this patch.
src/Managers/Register/Register.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
     {
46 46
         // Check if model class points to ManagedModel interface
47 47
         $ref = new \ReflectionClass($modelClass);
48
-        if(!$ref->implementsInterface(ManagedModel::class)) {
49
-            throw new \DomainException('Class ' . $modelClass . ' should implement contract ' . ManagedModel::class);
48
+        if (!$ref->implementsInterface(ManagedModel::class)) {
49
+            throw new \DomainException('Class '.$modelClass.' should implement contract '.ManagedModel::class);
50 50
         }
51 51
 
52 52
         $managedModelKey = $modelClass::managedModelKey();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $this->container->make(Registry::class)
56 56
             ->registerModel($managedModelKey, $modelClass)
57 57
             ->registerManager($managedModelKey, $manager)
58
-            ->registerTags($managedModelKey, (array) $tags);
58
+            ->registerTags($managedModelKey, (array)$tags);
59 59
 
60 60
         // Register routes
61 61
         $this->container->make(RegisterManagedRoutes::class)(
Please login to merge, or discard this patch.
src/Managers/Exceptions/NotAllowedManagerAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
 
41 41
     public static function notAllowedAction($action, string $managerKey)
42 42
     {
43
-        return new self('Not allowed to ' . $action . ' a model. ' . ucfirst($action) . ' route is not allowed by the ' . $managerKey . ' manager.');
43
+        return new self('Not allowed to '.$action.' a model. '.ucfirst($action).' route is not allowed by the '.$managerKey.' manager.');
44 44
     }
45 45
 
46 46
     public static function notAllowedPermission($permission, string $managerKey)
47 47
     {
48
-        return new self('Not allowed permission for ' . $permission . ' on a model as managed by the ' . $managerKey . ' manager.');
48
+        return new self('Not allowed permission for '.$permission.' on a model as managed by the '.$managerKey.' manager.');
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
src/Managers/Assistants/FragmentsAssistant.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function routeFragmentsAssistant(string $action, $model = null, ...$parameters): ?string
27 27
     {
28
-        if(!in_array($action, ['fragments-index','fragments-reorder'])) return null;
28
+        if (!in_array($action, ['fragments-index', 'fragments-reorder'])) return null;
29 29
 
30 30
         return $this->generateRoute($action, $model, ...$parameters);
31 31
     }
32 32
 
33 33
     public function canFragmentsAssistant(string $action, $model = null): bool
34 34
     {
35
-        return in_array($action, ['fragments-index','fragments-reorder']);
35
+        return in_array($action, ['fragments-index', 'fragments-reorder']);
36 36
     }
37 37
 
38 38
     public function fragmentsIndex(Request $request, $id)
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $model = $modelClass::findOrFail($id);
44 44
 
45 45
         // Current fragments
46
-        $fragments = app(FragmentRepository::class)->getByOwner($model)->map(function(Fragmentable $model){
46
+        $fragments = app(FragmentRepository::class)->getByOwner($model)->map(function(Fragmentable $model) {
47 47
             return [
48 48
                 'model'    => $model,
49 49
                 'manager'  => app(Registry::class)->manager($model::managedModelKey()),
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         });
52 52
 
53 53
         // Available fragments
54
-        $allowedFragments = array_map(function($fragmentableClass){
54
+        $allowedFragments = array_map(function($fragmentableClass) {
55 55
             $modelClass = app(Registry::class)->modelClass($fragmentableClass::managedModelKey());
56 56
             return [
57 57
                 'manager' => app(Registry::class)->manager($fragmentableClass::managedModelKey()),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@
 block discarded – undo
25 25
 
26 26
     public function routeFragmentsAssistant(string $action, $model = null, ...$parameters): ?string
27 27
     {
28
-        if(!in_array($action, ['fragments-index','fragments-reorder'])) return null;
28
+        if(!in_array($action, ['fragments-index','fragments-reorder'])) {
29
+            return null;
30
+        }
29 31
 
30 32
         return $this->generateRoute($action, $model, ...$parameters);
31 33
     }
Please login to merge, or discard this patch.
src/Managers/Assistants/ManagerDefaults.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function route(string $action, $model = null, ...$parameters): string
30 30
     {
31
-        foreach(DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) {
32
-            if(null !== ($route = $this->$method($action, $model, ...$parameters))){
31
+        foreach (DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) {
32
+            if (null !== ($route = $this->$method($action, $model, ...$parameters))) {
33 33
                 return $route;
34 34
             }
35 35
         }
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function can(string $action, $model = null): bool
41 41
     {
42
-        foreach(DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) {
43
-            if(true === $this->$method($action, $model)){
42
+        foreach (DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) {
43
+            if (true === $this->$method($action, $model)) {
44 44
                 return true;
45 45
             }
46 46
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $parameters = array_merge((array)$modelId, $parameters);
57 57
         }
58 58
 
59
-        return route('chief.' . $this->managedModelClass()::managedModelKey() . '.' . $action, $parameters);
59
+        return route('chief.'.$this->managedModelClass()::managedModelKey().'.'.$action, $parameters);
60 60
     }
61 61
 
62 62
     private function guard(string $action)
Please login to merge, or discard this patch.