1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace oliverde8\ComfyBundle\Resolver; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
use oliverde8\AssociativeArraySimplified\AssociativeArray; |
|
|
|
|
8
|
|
|
|
9
|
|
|
abstract class AbstractScopeResolver implements ScopeResolverInterface |
10
|
|
|
{ |
11
|
|
|
/** @var array */ |
12
|
|
|
private ?array $scopes = null; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @inheritDoc |
16
|
|
|
*/ |
17
|
|
|
public function validateScope(string $scope = null): bool |
18
|
|
|
{ |
19
|
|
|
$scopes = $this->getScopes(); |
20
|
|
|
$scope = $this->getScope($scope); |
21
|
|
|
return isset($scopes[$scope]); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @inheritDoc |
26
|
|
|
*/ |
27
|
|
|
public function getScope(string $scope = null): string |
28
|
|
|
{ |
29
|
|
|
if (is_null($scope)) { |
30
|
|
|
$scope = $this->getCurrentScope(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
return $scope; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @inheritDoc |
38
|
|
|
*/ |
39
|
|
|
public function inherits(string $scope = null): ?string |
40
|
|
|
{ |
41
|
|
|
$scope = $this->getScope($scope); |
42
|
|
|
|
43
|
|
|
$parts = explode('/', $scope); |
44
|
|
|
if (count($parts) <= 1) { |
45
|
|
|
return null; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
array_pop($parts); |
49
|
|
|
return implode('/', $parts); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @inheritDoc |
54
|
|
|
*/ |
55
|
|
|
public function getScopeTree() : array |
56
|
|
|
{ |
57
|
|
|
$data = []; |
58
|
|
|
foreach ($this->scopes as $scopeKey => $scopeName) { |
59
|
|
|
$parentScopeKey = $this->inherits($scopeKey); |
60
|
|
|
if ($parentScopeKey && !AssociativeArray::checkKeyExist($data, $parentScopeKey . "/~name")) { |
61
|
|
|
AssociativeArray::setFromKey($data, $parentScopeKey . "/~name", $parentScopeKey); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
AssociativeArray::setFromKey($data, $scopeKey . "/~name", $scopeName); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
return $data; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return array |
72
|
|
|
*/ |
73
|
|
|
protected function getScopes(): array |
74
|
|
|
{ |
75
|
|
|
if (is_null($this->scopes)) { |
76
|
|
|
$this->scopes = $this->initScopes(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
return $this->scopes; |
|
|
|
|
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
abstract protected function initScopes(): array; |
83
|
|
|
} |
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