1 | <?php |
||
11 | class ConfigurationManager { |
||
12 | /** @var FileLocatorInterface * */ |
||
13 | protected $locator; |
||
14 | /** @var AbacLoader[] * */ |
||
15 | protected $loaders; |
||
16 | /** @var array * */ |
||
17 | protected $rules; |
||
18 | /** @var array * */ |
||
19 | protected $attributes; |
||
20 | |||
21 | // protected $config_path_route; |
||
22 | |||
23 | /** @var array List of File Already Loader */ |
||
24 | protected $config_files_loaded; |
||
25 | |||
26 | /** |
||
27 | * @param FileLocatorInterface $locator |
||
28 | * @param string|array $format A format or an array of format |
||
29 | */ |
||
30 | 12 | public function __construct( FileLocatorInterface $locator, $format = [ |
|
31 | 'yaml', |
||
32 | 'json', |
||
33 | ] ) { |
||
34 | 12 | $this->locator = $locator; |
|
35 | 12 | $this->attributes = []; |
|
36 | 12 | $this->rules = []; |
|
37 | 12 | $this->config_files_loaded = []; |
|
38 | 12 | if ( in_array( 'yaml', $format ) ) { |
|
39 | 12 | $this->loaders[ 'yaml' ] = new YamlAbacLoader( $locator, $this ); |
|
|
|||
40 | 12 | } |
|
41 | 12 | if ( in_array( 'json', $format ) ) { |
|
42 | 12 | $this->loaders[ 'json' ] = new JsonAbacLoader( $locator, $this ); |
|
43 | 12 | } |
|
44 | |||
45 | 12 | } |
|
46 | |||
47 | 4 | public function setConfigPathRoot($configPaths_root = null) { |
|
53 | |||
54 | /** |
||
55 | * @param array $configurationFiles |
||
56 | */ |
||
57 | 12 | public function parseConfigurationFile( $configurationFiles ) { |
|
80 | |||
81 | |||
82 | |||
83 | /** |
||
84 | * Function to retrieve the good loader for the configuration file |
||
85 | * |
||
86 | * @param $configurationFile |
||
87 | * |
||
88 | * @return AbacLoader |
||
89 | * |
||
90 | * @throws \Exception |
||
91 | */ |
||
92 | 12 | private function getLoader( $configurationFile ) { |
|
101 | |||
102 | /** |
||
103 | * @return array |
||
104 | */ |
||
105 | 12 | public function getAttributes() { |
|
108 | |||
109 | /** |
||
110 | * @return array |
||
111 | */ |
||
112 | 6 | public function getRules() { |
|
115 | } |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.