1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* This file is part of the O2System Framework package.
|
4
|
|
|
*
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE
|
6
|
|
|
* file that was distributed with this source code.
|
7
|
|
|
*
|
8
|
|
|
* @author Steeve Andrian Salim
|
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim
|
10
|
|
|
*/
|
11
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------
|
13
|
|
|
|
14
|
|
|
namespace O2System\Spl\Traits\Collectors;
|
15
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------
|
17
|
|
|
use O2System\Kernel\DataStructures\Config;
|
|
|
|
|
18
|
|
|
|
19
|
|
|
/**
|
20
|
|
|
* Class ConfigCollectorTrait
|
21
|
|
|
*
|
22
|
|
|
* @package O2System\Spl\Traits\Collectors
|
23
|
|
|
*/
|
24
|
|
|
trait ConfigCollectorTrait
|
25
|
|
|
{
|
26
|
|
|
/**
|
27
|
|
|
* List of Config
|
28
|
|
|
*
|
29
|
|
|
* @type array
|
30
|
|
|
*/
|
31
|
|
|
protected $config = [];
|
32
|
|
|
|
33
|
|
|
/**
|
34
|
|
|
* Add Config
|
35
|
|
|
*
|
36
|
|
|
* @param $key
|
37
|
|
|
* @param $value
|
38
|
|
|
*
|
39
|
|
|
* @return $this
|
40
|
|
|
*/
|
41
|
|
|
public function addConfig($key, $value)
|
42
|
|
|
{
|
43
|
|
|
if (isset($this->config[ $key ])) {
|
44
|
|
|
if (is_array($value) AND is_array($this->config[ $key ])) {
|
45
|
|
|
$this->config[ $key ] = array_merge($this->config[ $key ], $value);
|
46
|
|
|
} else {
|
47
|
|
|
$this->config[ $key ] = $value;
|
48
|
|
|
}
|
49
|
|
|
} else {
|
50
|
|
|
$this->config[ $key ] = $value;
|
51
|
|
|
}
|
52
|
|
|
|
53
|
|
|
return $this;
|
54
|
|
|
}
|
55
|
|
|
|
56
|
|
|
// ------------------------------------------------------------------------
|
57
|
|
|
|
58
|
|
|
/**
|
59
|
|
|
* Get Config
|
60
|
|
|
*
|
61
|
|
|
* @access public
|
62
|
|
|
* @final this method can't be overwritten
|
63
|
|
|
*
|
64
|
|
|
* @param string|null $key Config item index name
|
65
|
|
|
*
|
66
|
|
|
* @return mixed
|
67
|
|
|
*/
|
68
|
|
|
final public function getConfig($key = null, $offset = null)
|
69
|
|
|
{
|
70
|
|
|
if (isset($key)) {
|
71
|
|
|
if (isset($this->config[ $key ])) {
|
72
|
|
|
if (isset($offset)) {
|
73
|
|
|
return isset($this->config[ $key ][ $offset ]) ? $this->config[ $key ][ $offset ] : null;
|
74
|
|
|
}
|
75
|
|
|
|
76
|
|
|
return $this->config[ $key ];
|
77
|
|
|
}
|
78
|
|
|
|
79
|
|
|
return false;
|
80
|
|
|
}
|
81
|
|
|
|
82
|
|
|
return $this->config;
|
83
|
|
|
}
|
84
|
|
|
|
85
|
|
|
// ------------------------------------------------------------------------
|
86
|
|
|
|
87
|
|
|
/**
|
88
|
|
|
* Set Config
|
89
|
|
|
*
|
90
|
|
|
* @access public
|
91
|
|
|
*
|
92
|
|
|
* @param array|string $key
|
93
|
|
|
*
|
94
|
|
|
* @return static
|
95
|
|
|
*/
|
96
|
|
|
public function setConfig($key, $value = null)
|
97
|
|
|
{
|
98
|
|
|
if (is_array($key)) {
|
99
|
|
|
if (empty($this->config)) {
|
100
|
|
|
$this->config = $key;
|
101
|
|
|
} else {
|
102
|
|
|
$this->config = array_merge($this->config, $key);
|
103
|
|
|
}
|
104
|
|
|
} elseif ($key instanceof Config) {
|
|
|
|
|
105
|
|
|
$this->config = $key;
|
106
|
|
|
} elseif (isset($this->config[ $key ])) {
|
107
|
|
|
if (is_array($value) AND is_array($this->config[ $key ])) {
|
108
|
|
|
$this->config[ $key ] = array_merge($this->config[ $key ], $value);
|
109
|
|
|
} else {
|
110
|
|
|
$this->config[ $key ] = $value;
|
111
|
|
|
}
|
112
|
|
|
} else {
|
113
|
|
|
$this->config[ $key ] = $value;
|
114
|
|
|
}
|
115
|
|
|
|
116
|
|
|
return $this;
|
117
|
|
|
}
|
118
|
|
|
} |
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