1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Component\Db; |
4
|
|
|
|
5
|
|
|
use ArrayAccess; |
6
|
|
|
use Countable; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Pool is a storage to store object identified by a string key |
10
|
|
|
*/ |
11
|
|
|
class Pool implements ArrayAccess, Countable |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* connections |
16
|
|
|
* |
17
|
|
|
* @var array |
18
|
|
|
*/ |
19
|
|
|
private $connections = []; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Assigns a value to the specified offset |
23
|
|
|
* |
24
|
|
|
* @param string The offset to assign the value to |
25
|
|
|
* @param mixed The value to set |
|
|
|
|
26
|
|
|
*/ |
27
|
1 |
|
public function offsetSet($connexionId, $connection) |
28
|
|
|
{ |
29
|
1 |
|
if ($this->valid($connexionId, $connection)) { |
30
|
1 |
|
$this->connections[$connexionId] = $connection; |
31
|
|
|
} |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Whether or not an offset exists |
36
|
|
|
* |
37
|
|
|
* @param string An offset to check for |
|
|
|
|
38
|
|
|
* @return boolean |
39
|
|
|
*/ |
40
|
1 |
|
public function offsetExists($connexionId) |
41
|
|
|
{ |
42
|
1 |
|
return isset($this->connections[$connexionId]); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Unsets an offset |
47
|
|
|
* |
48
|
|
|
* @param string The offset to unset |
49
|
|
|
*/ |
50
|
1 |
|
public function offsetUnset($connexionId) |
51
|
|
|
{ |
52
|
1 |
|
if ($this->offsetExists($connexionId)) { |
53
|
1 |
|
unset($this->connections[$connexionId]); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Returns the value at specified offset |
59
|
|
|
* |
60
|
|
|
* @param string The offset to retrieve |
61
|
|
|
* @return mixed |
62
|
|
|
*/ |
63
|
1 |
|
public function offsetGet($connexionId) |
64
|
|
|
{ |
65
|
1 |
|
return $this->offsetExists($connexionId) |
66
|
1 |
|
? $this->connections[$connexionId] |
67
|
1 |
|
: null; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* return number of connections |
72
|
|
|
* |
73
|
|
|
* @return integer |
74
|
|
|
*/ |
75
|
1 |
|
public function count() |
76
|
|
|
{ |
77
|
1 |
|
return count($this->connections); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* return true id connectionId is not null and is string |
82
|
|
|
* and connection is object |
83
|
|
|
* |
84
|
|
|
* @param string $connexionId |
85
|
|
|
* @param object $connection |
86
|
|
|
* @return boolean |
87
|
|
|
*/ |
88
|
23 |
|
protected function valid($connexionId, $connection): bool |
89
|
|
|
{ |
90
|
23 |
|
return (!is_null($connexionId) |
91
|
23 |
|
&& is_string($connexionId) |
92
|
23 |
|
&& is_object($connection)); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
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