| 1 | <?php |
||
| 22 | class Collection implements ArrayAccess, Countable |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * Data collection as array |
||
| 26 | * @var array |
||
| 27 | */ |
||
| 28 | private $data; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Callback filter to be applied on all values |
||
| 32 | * @var callable|null |
||
| 33 | */ |
||
| 34 | private $valueFilter; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Callback filter to be applied on all keys |
||
| 38 | * @var callable|null |
||
| 39 | */ |
||
| 40 | private $keyFilter; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Build Collection |
||
| 44 | * @param array $data |
||
| 45 | * @param callable|null $key |
||
|
|
|||
| 46 | * @param callable|null $value |
||
| 47 | 24 | */ |
|
| 48 | public function __construct(array $data = []) |
||
| 52 | 24 | ||
| 53 | /** |
||
| 54 | * Set the keyFilter callable |
||
| 55 | * @param callable $key |
||
| 56 | * @return Collection |
||
| 57 | */ |
||
| 58 | public function withKeyFilter(callable $key) |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Set the valueFilter callable |
||
| 66 | * @param callable $value |
||
| 67 | 5 | * @return Collection |
|
| 68 | */ |
||
| 69 | 5 | public function withValueFilter(callable $value) |
|
| 74 | |||
| 75 | /** |
||
| 76 | * Build a new Collection from an existing array |
||
| 77 | * @param array $data |
||
| 78 | 15 | * @return Collection |
|
| 79 | */ |
||
| 80 | 15 | public static function fromArray(array $data) |
|
| 84 | 15 | ||
| 85 | /** |
||
| 86 | 15 | * @see \Countable::count |
|
| 87 | * @return integer |
||
| 88 | */ |
||
| 89 | public function count() |
||
| 93 | 5 | ||
| 94 | /** |
||
| 95 | * @see \ArrayAccess::offsetGet |
||
| 96 | 5 | * @return mixed |
|
| 97 | 5 | */ |
|
| 98 | public function offsetGet($offset) |
||
| 103 | |||
| 104 | 1 | /** |
|
| 105 | * @see \ArrayAccess::offsetSet |
||
| 106 | 1 | * @param mixed $offset |
|
| 107 | 1 | * @param mixed $value |
|
| 108 | 1 | */ |
|
| 109 | 1 | public function offsetSet($offset, $value) |
|
| 118 | |||
| 119 | 15 | /** |
|
| 120 | 15 | * @see \ArrayAccess::offsetExists |
|
| 121 | 15 | * @param mixed $offset |
|
| 122 | 15 | * @return boolean |
|
| 123 | */ |
||
| 124 | public function offsetExists($offset) |
||
| 128 | |||
| 129 | /** |
||
| 130 | 15 | * @see \ArrayAccess::offsetUnset |
|
| 131 | * @param mixed $offset |
||
| 132 | 15 | */ |
|
| 133 | 15 | public function offsetUnset($offset) |
|
| 140 | |||
| 141 | /** |
||
| 142 | * Handle value to be used in the collection |
||
| 143 | * @param mixed $item |
||
| 144 | 15 | * @return mixed The filtered value |
|
| 145 | */ |
||
| 146 | 15 | protected function value($item) |
|
| 153 | |||
| 154 | /** |
||
| 155 | * Handle key to be used in the collection |
||
| 156 | 1 | * @param mixed $item |
|
| 157 | * @return mixed The filtered key |
||
| 158 | 1 | */ |
|
| 159 | 1 | protected function key($item) |
|
| 166 | 3 | ||
| 167 | /** |
||
| 168 | 3 | * Filter an item with a callback |
|
| 169 | * @param mixed $item |
||
| 170 | * @param callable|null $filter |
||
| 171 | * @return mixed |
||
| 172 | */ |
||
| 173 | protected function handle($item, callable $filter = null) |
||
| 180 | |||
| 181 | /** |
||
| 182 | * Flush all items from the collection |
||
| 183 | * @return Collection |
||
| 184 | */ |
||
| 185 | public function flush() |
||
| 190 | |||
| 191 | /** |
||
| 192 | * Transform the collection to a basic array |
||
| 193 | * @return array |
||
| 194 | */ |
||
| 195 | public function toArray() |
||
| 199 | |||
| 200 | /** |
||
| 201 | * @see \IteratorAggregate::getIterator |
||
| 202 | * @return \ArrayIterator |
||
| 203 | */ |
||
| 204 | public function getIterator() |
||
| 208 | } |
||
| 209 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.