| 1 | <?php |
||
| 24 | class BaseCollection implements SeekableIterator, Countable, ArrayAccess |
||
| 25 | { |
||
| 26 | use IterableTrait; |
||
| 27 | use CountableTrait; |
||
| 28 | use SeekableTrait; |
||
| 29 | use SearchableTrait; |
||
| 30 | use ArrayAccessTrait; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var array |
||
| 34 | */ |
||
| 35 | protected $elements; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * BaseCollection constructor |
||
| 39 | * |
||
| 40 | * @param array $elements |
||
| 41 | */ |
||
| 42 | 56 | public function __construct(array $elements = []) |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Return element at $key |
||
| 49 | * |
||
| 50 | * @param mixed $key |
||
| 51 | * @return mixed |
||
| 52 | */ |
||
| 53 | 6 | public function get($key) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Return keys |
||
| 60 | * |
||
| 61 | * @return array |
||
| 62 | */ |
||
| 63 | 2 | public function getKeys() |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Return values |
||
| 70 | * |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | 2 | public function getValues() |
|
| 77 | |||
| 78 | /** |
||
| 79 | * Return elements array |
||
| 80 | * |
||
| 81 | * @return array |
||
| 82 | */ |
||
| 83 | 1 | public function toArray() |
|
| 87 | } |
||
| 88 |