1 | <?php |
||
11 | class BranchCollection implements ArrayAccess, Countable, IteratorAggregate |
||
12 | { |
||
13 | private $branches; |
||
14 | |||
15 | 36 | public function __construct(array $branches = []) |
|
21 | |||
22 | 12 | public function hasBranches() |
|
26 | |||
27 | 18 | public function push(Branch $branch) |
|
33 | |||
34 | 3 | public function __get($key) |
|
40 | |||
41 | 36 | public static function validateBranches($branches) |
|
51 | |||
52 | 3 | public function offsetSet($offset, $value) { |
|
59 | |||
60 | 3 | public function offsetExists($offset) { |
|
63 | |||
64 | public function offsetUnset($offset) { |
||
67 | |||
68 | 21 | public function offsetGet($offset) { |
|
71 | |||
72 | 21 | public function count() |
|
76 | |||
77 | /** |
||
78 | * Iterator for the branches |
||
79 | * |
||
80 | * @return \ArrayIterator |
||
81 | */ |
||
82 | 24 | public function getIterator() |
|
86 | |||
87 | 3 | public function toArray() |
|
91 | |||
92 | public function flatten() |
||
96 | } |
||
97 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.