1 | <?php |
||||
2 | |||||
3 | namespace oliverde8\ComfyBundle\Manager; |
||||
4 | |||||
5 | use oliverde8\ComfyBundle\Model\ConfigInterface; |
||||
6 | use oliverde8\ComfyBundle\Model\Scope; |
||||
7 | use oliverde8\ComfyBundle\Resolver\ScopeResolverInterface; |
||||
8 | use oliverde8\ComfyBundle\Security\ScopeVoter; |
||||
9 | use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; |
||||
0 ignored issues
–
show
|
|||||
10 | |||||
11 | class ConfigDisplayManager |
||||
12 | { |
||||
13 | protected AuthorizationCheckerInterface $checker; |
||||
14 | protected ConfigManagerInterface $configManager; |
||||
15 | protected ScopeResolverInterface $scopeResolver; |
||||
16 | |||||
17 | public function __construct( |
||||
18 | ConfigManagerInterface $configManager, |
||||
19 | ScopeResolverInterface $scopeResolver, |
||||
20 | AuthorizationCheckerInterface $checker |
||||
21 | ) { |
||||
22 | $this->configManager = $configManager; |
||||
23 | $this->scopeResolver = $scopeResolver; |
||||
24 | $this->checker = $checker; |
||||
25 | } |
||||
26 | |||||
27 | public function getConfigHtmlName(ConfigInterface $config) |
||||
28 | { |
||||
29 | return str_replace("/", "-", $config->getPath()); |
||||
30 | } |
||||
31 | |||||
32 | public function getScopeTreeForHtml() |
||||
33 | { |
||||
34 | return $this->getRecursiveScopeTreeForHtml($this->scopeResolver->getScopeTree()); |
||||
35 | } |
||||
36 | |||||
37 | public function getFirstConfigPath(): ?string |
||||
38 | { |
||||
39 | return $this->getRecursiveFirstConfigPath($this->configManager->getAllConfigs()->getArray()); |
||||
0 ignored issues
–
show
The function
oliverde8\ComfyBundle\Ma...ursiveFirstConfigPath() has been deprecated: This method is now internal, use getFirstConfigPath instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
40 | } |
||||
41 | |||||
42 | /** |
||||
43 | * Get path to the first config element. |
||||
44 | * |
||||
45 | * @param $configItems |
||||
46 | * @param string $parent |
||||
47 | * @return string|null |
||||
48 | * @deprecated This method is now internal, use getFirstConfigPath instead. |
||||
49 | */ |
||||
50 | public function getRecursiveFirstConfigPath($configItems, $parent = "") |
||||
51 | { |
||||
52 | foreach ($configItems as $key => $config) { |
||||
53 | if (is_object($config)) { |
||||
54 | return null; |
||||
55 | } |
||||
56 | $child = $this->getRecursiveFirstConfigPath( $config, $parent . "/" . $key); |
||||
0 ignored issues
–
show
The function
oliverde8\ComfyBundle\Ma...ursiveFirstConfigPath() has been deprecated: This method is now internal, use getFirstConfigPath instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
57 | |||||
58 | if (is_null($child)) { |
||||
59 | return $parent . "/" . $key; |
||||
60 | } else { |
||||
61 | return $child; |
||||
62 | } |
||||
63 | } |
||||
64 | } |
||||
65 | |||||
66 | protected function getRecursiveScopeTreeForHtml($tree, $parent = "") |
||||
67 | { |
||||
68 | $data = []; |
||||
69 | |||||
70 | if (isset($tree['~name'])) { |
||||
71 | $data['name'] = $tree['~name']; |
||||
72 | unset($tree['~name']); |
||||
73 | } |
||||
74 | |||||
75 | $data['sub_scopes'] = []; |
||||
76 | if (count($tree) > 0) { |
||||
77 | foreach ($tree as $key => $item) { |
||||
78 | if ($this->checker->isGranted(ScopeVoter::ACTION_VIEW, new Scope($parent . $key . "/"))) { |
||||
79 | $data['sub_scopes'][$parent . $key] = $this->getRecursiveScopeTreeForHtml($item, $parent . $key . "/"); |
||||
80 | } |
||||
81 | } |
||||
82 | } |
||||
83 | |||||
84 | return $data; |
||||
85 | } |
||||
86 | |||||
87 | |||||
88 | } |
||||
89 |
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