1 | <?php namespace Rocket\Entities; |
||
5 | class FieldCollection extends \Illuminate\Support\Collection |
||
6 | { |
||
7 | /** |
||
8 | * @var int The max items this collection can hold |
||
9 | */ |
||
10 | protected $maxItems = 1; |
||
11 | |||
12 | /** |
||
13 | * @var array The Collection configuration |
||
14 | */ |
||
15 | protected $configuration = []; |
||
16 | |||
17 | /** |
||
18 | * @var string The type of this collection |
||
19 | */ |
||
20 | protected $type; |
||
21 | |||
22 | /** |
||
23 | * Initialize a collection with the configuration |
||
24 | * |
||
25 | * @param array $configuration |
||
26 | * @return static |
||
27 | */ |
||
28 | 63 | public static function initField($configuration = []) |
|
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 18 | public function offsetSet($key, $value) |
|
63 | |||
64 | /** |
||
65 | * Get an item at a given offset. |
||
66 | * |
||
67 | * @param mixed $key |
||
68 | * @return mixed |
||
69 | */ |
||
70 | 6 | public function offsetGet($key) |
|
80 | |||
81 | /** |
||
82 | * Remove all items in this collection |
||
83 | * |
||
84 | * @return void |
||
85 | */ |
||
86 | 9 | public function clear() |
|
90 | |||
91 | /** |
||
92 | * Get the number of items possible in this collection. |
||
93 | * |
||
94 | * @return int |
||
95 | */ |
||
96 | 18 | public function getMaxItems() |
|
100 | |||
101 | /** |
||
102 | * As we use a field collection even if we have only one value, we use it that way. |
||
103 | * |
||
104 | * @return array|null |
||
105 | */ |
||
106 | 6 | public function toArray() |
|
121 | |||
122 | 3 | public function __toString() |
|
130 | } |
||
131 |