|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace Xervice\Core\Business\Model\Locator; |
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
use Xervice\Config\Business\XerviceConfig; |
|
8
|
|
|
use Xervice\Core\Business\Model\Locator\Proxy\AbstractLocatorProxy; |
|
9
|
|
|
use Xervice\Core\Business\Model\Locator\Proxy\LocatorProxy; |
|
10
|
|
|
use Xervice\Core\Business\Model\Locator\Proxy\LocatorProxyInterface; |
|
11
|
|
|
use Xervice\Core\CoreConfig; |
|
12
|
|
|
|
|
13
|
|
|
class Locator |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var \Xervice\Core\Business\Model\Locator\Locator |
|
17
|
|
|
*/ |
|
18
|
|
|
private static $instance; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var array |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $coreNamespaces; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $projectNamespaces; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var array |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $services; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Locator constructor. |
|
37
|
|
|
* |
|
38
|
|
|
* @param array $coreNamespaces |
|
39
|
|
|
* @param array $projectNamespaces |
|
40
|
|
|
*/ |
|
41
|
1 |
|
public function __construct(array $coreNamespaces, array $projectNamespaces) |
|
42
|
|
|
{ |
|
43
|
1 |
|
$this->coreNamespaces = $coreNamespaces; |
|
44
|
1 |
|
$this->projectNamespaces = $projectNamespaces; |
|
45
|
1 |
|
$this->services = []; |
|
46
|
1 |
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return \Generated\Ide\LocatorAutoComplete|\Xervice\Core\Business\Model\Locator\Locator |
|
|
|
|
|
|
50
|
|
|
*/ |
|
51
|
10 |
|
public static function getInstance(): Locator |
|
52
|
|
|
{ |
|
53
|
10 |
|
if (self::$instance === null) { |
|
54
|
1 |
|
self::$instance = new self( |
|
55
|
1 |
|
XerviceConfig::get(CoreConfig::CORE_NAMESPACES, ['Xervice']), |
|
56
|
1 |
|
XerviceConfig::get(CoreConfig::PROJECT_NAMESPACES, ['App']) |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
10 |
|
return self::$instance; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param string $name |
|
64
|
|
|
* @param array $arguments |
|
65
|
|
|
* |
|
66
|
|
|
* @return \Xervice\Core\Business\Model\Locator\Proxy\LocatorProxyInterface |
|
67
|
|
|
*/ |
|
68
|
9 |
|
public function __call(string $name, array $arguments) |
|
69
|
|
|
{ |
|
70
|
9 |
|
if (!isset($this->services[$name])) { |
|
71
|
2 |
|
$this->services[$name] = $this->getServiceProxy($name); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
9 |
|
return $this->services[$name]; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @param string $service |
|
79
|
|
|
* |
|
80
|
|
|
* @return \Xervice\Core\Business\Model\Locator\Proxy\AbstractLocatorProxy |
|
81
|
|
|
*/ |
|
82
|
2 |
|
protected function getServiceProxy(string $service): LocatorProxyInterface |
|
83
|
|
|
{ |
|
84
|
2 |
|
return new LocatorProxy( |
|
85
|
2 |
|
$this->coreNamespaces, |
|
86
|
2 |
|
$this->projectNamespaces, |
|
87
|
2 |
|
ucfirst($service) |
|
88
|
|
|
); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
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