|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Backpack\CRUD\app\Library\CrudPanel; |
|
4
|
|
|
|
|
5
|
|
|
use Backpack\CRUD\app\Library\Contracts\CrudControllerContract; |
|
|
|
|
|
|
6
|
|
|
use Illuminate\Support\Facades\App; |
|
7
|
|
|
use ReflectionClass; |
|
8
|
|
|
|
|
9
|
|
|
final class CrudRouter |
|
10
|
|
|
{ |
|
11
|
|
|
public static function setupControllerRoutes(string $name, string $routeName, string $controller, string $groupNamespace = ''): void |
|
12
|
|
|
{ |
|
13
|
|
|
$namespacedController = $groupNamespace.$controller; |
|
14
|
|
|
|
|
15
|
|
|
$controllerReflection = new ReflectionClass($namespacedController); |
|
16
|
|
|
$setupRoutesMethod = $controllerReflection->getMethod('setupRoutes'); |
|
17
|
|
|
|
|
18
|
|
|
// check if method has #[DeprecatedIgnoreOnRuntime] attribute |
|
19
|
|
|
if (empty($setupRoutesMethod->getAttributes(\Backpack\CRUD\app\Library\Attributes\DeprecatedIgnoreOnRuntime::class))) { |
|
20
|
|
|
// when the attribute is not found the developer has overwritten the method |
|
21
|
|
|
// we will keep the old behavior for backwards compatibility |
|
22
|
|
|
$setupRoutesMethod->invoke(App::make($namespacedController), $name, $routeName, $controller); |
|
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
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths