| 1 | <?php |
||
| 5 | class ArrayHelper |
||
| 6 | { |
||
| 7 | /** @var array */ |
||
| 8 | protected $array; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * ArrayHelper constructor. Accepts and stores an array. |
||
| 12 | * |
||
| 13 | * @throws \InvalidArgumentException if not initialized with an array |
||
| 14 | * @param mixed[] $array The array needing help |
||
| 15 | */ |
||
| 16 | 7 | public function __construct($array) |
|
| 24 | |||
| 25 | /** |
||
| 26 | * Returns the value corresponding with a supplied key; returns FALSE if the supplied key does not exist within |
||
| 27 | * the array. |
||
| 28 | * |
||
| 29 | * **WARNING** This function may return FALSE or a non-Boolean value that evaluates to FALSE even if a supplied |
||
| 30 | * key exists |
||
| 31 | * |
||
| 32 | * @param int|string $key The key to look up |
||
| 33 | * @return bool|mixed Returns FALSE if the supplied key does not exist within the array |
||
| 34 | * Returns the value corresponding with the key otherwise |
||
| 35 | */ |
||
| 36 | 2 | public function valueLookup($key) |
|
| 46 | } |