Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — fix-upload-validators-in-repea... ( 7dffce...2c7240 )
by Pedro
41:38 queued 26:39
created

CrudRouter   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 16
c 2
b 1
f 0
dl 0
loc 28
rs 10
wmc 8

1 Method

Rating   Name   Duplication   Size   Complexity  
B setupControllerRoutes() 0 26 8
1
<?php
2
3
namespace Backpack\CRUD\app\Library\CrudPanel;
4
5
use Illuminate\Support\Facades\App;
6
use ReflectionClass;
7
8
final class CrudRouter
9
{
10
    public static function setupControllerRoutes(string $name, string $routeName, string $controller, string $groupNamespace = ''): void
11
    {
12
        $namespacedController = $groupNamespace.$controller;
13
14
        $controllerReflection = new ReflectionClass($namespacedController);
15
        $setupRoutesMethod = $controllerReflection->getMethod('setupRoutes');
16
17
        // check if method has #[DeprecatedIgnoreOnRuntime] attribute
18
        if (empty($setupRoutesMethod->getAttributes(\Backpack\CRUD\app\Library\Attributes\DeprecatedIgnoreOnRuntime::class))) {
19
            // when the attribute is not found the developer has overwritten the method
20
            // we will keep the old behavior for backwards compatibility
21
            $setupRoutesMethod->invoke(App::make($namespacedController), $name, $routeName, $controller);
22
23
            return;
24
        }
25
26
        $controllerInstance = $controllerReflection->newInstanceWithoutConstructor();
27
        foreach ($controllerReflection->getMethods() as $method) {
28
            if (($method->isPublic() ||
29
                $method->isProtected()) &&
30
                $method->getName() !== 'setupRoutes' &&
31
                str_starts_with($method->getName(), 'setup') &&
32
                str_ends_with($method->getName(), 'Routes')
33
            ) {
34
                $method->setAccessible(true);
35
                $method->invoke($controllerInstance, $name, $routeName, $controller);
36
            }
37
        }
38
    }
39
}
40