1 | <?php |
||
2 | |||
3 | namespace Anax\Proxy; |
||
4 | |||
5 | use Psr\Container\ContainerInterface; |
||
6 | |||
7 | /** |
||
8 | * Create a proxy application for the $di container. This class initiates the |
||
9 | * the base proxy class ProxyDI and creates an autoloader which creates new |
||
10 | * instanses of proxy classes. These instances are the actual implementation |
||
11 | * that enables the access to the corresponding $di service. |
||
12 | */ |
||
13 | class ProxyDIFactory |
||
14 | { |
||
15 | /** |
||
16 | * Init the poxy base class and add an autoloader which can create new |
||
17 | * instances of specific proxy service classes that maps to a $di service. |
||
18 | * |
||
19 | * @param DIInterface $di The service container holding framework |
||
0 ignored issues
–
show
|
|||
20 | * services. |
||
21 | * |
||
22 | * @return void. |
||
0 ignored issues
–
show
|
|||
23 | * |
||
24 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
25 | */ |
||
26 | 4 | public static function init(ContainerInterface $di) : void |
|
27 | { |
||
28 | 4 | ProxyDI::setDI($di); |
|
29 | 4 | spl_autoload_register(__CLASS__ . "::autoloader"); |
|
30 | 4 | } |
|
31 | |||
32 | |||
33 | |||
34 | /** |
||
35 | * Autoloader for Proxy\DI realtime static proxy access to $di. |
||
36 | * |
||
37 | * @param string $class The name of the class to create, the |
||
38 | * classname must be a direct subclass of |
||
39 | * \Anax\Proxy\DI\. |
||
40 | * |
||
41 | * @return void |
||
42 | * |
||
43 | * @SuppressWarnings(PHPMD.EvalExpression) |
||
44 | */ |
||
45 | 3 | public static function autoloader($class) : void |
|
46 | { |
||
47 | 3 | $prefix = "Anax\\Proxy\\DI"; |
|
48 | |||
49 | // Check if it is a class below namespace $prefix |
||
50 | 3 | if (strncmp($prefix, $class, strlen($prefix))) { |
|
51 | 1 | return; |
|
52 | } |
||
53 | |||
54 | // Get the classname after the $prefix |
||
55 | 2 | $relativeClass = substr($class, strlen($prefix) + 1); |
|
56 | |||
57 | $classDefinition = <<< EOD |
||
58 | namespace Anax\Proxy\DI; |
||
59 | |||
60 | use Anax\Proxy\ProxyDI; |
||
61 | use Anax\Proxy\ProxyInterface; |
||
62 | |||
63 | 2 | class $relativeClass extends ProxyDI implements ProxyInterface |
|
64 | { |
||
65 | public static function getServiceName() |
||
66 | { |
||
67 | 2 | return lcfirst("$relativeClass"); |
|
68 | } |
||
69 | } |
||
70 | |||
71 | EOD; |
||
72 | |||
73 | 2 | eval($classDefinition); |
|
0 ignored issues
–
show
|
|||
74 | 2 | } |
|
75 | } |
||
76 |
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