1 | <?php namespace Rocket\Entities; |
||
6 | class FieldCollection extends \Illuminate\Support\Collection |
||
7 | { |
||
8 | /** |
||
9 | * @var int The max items this collection can hold |
||
10 | */ |
||
11 | protected $maxItems = 1; |
||
12 | |||
13 | /** |
||
14 | * @var array The Collection configuration |
||
15 | */ |
||
16 | protected $configuration = []; |
||
17 | |||
18 | /** |
||
19 | * @var string The type of this collection |
||
20 | */ |
||
21 | protected $type; |
||
22 | |||
23 | /** |
||
24 | * Initialize a collection with the configuration |
||
25 | * |
||
26 | * @param array $configuration |
||
27 | * @return static |
||
28 | */ |
||
29 | 66 | public static function initField($configuration = []) |
|
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 51 | public function offsetSet($key, $value) |
|
68 | |||
69 | /** |
||
70 | * Get an item at a given offset. |
||
71 | * |
||
72 | * @param mixed $key |
||
73 | * @return mixed |
||
74 | */ |
||
75 | 6 | public function offsetGet($key) |
|
85 | |||
86 | /** |
||
87 | * Remove all items in this collection |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | 9 | public function clear() |
|
95 | |||
96 | /** |
||
97 | * Get the number of items possible in this collection. |
||
98 | * |
||
99 | * @return int |
||
100 | */ |
||
101 | 54 | public function getMaxItems() |
|
105 | |||
106 | /** |
||
107 | * As we use a field collection even if we have only one value, we use it that way. |
||
108 | * |
||
109 | * @return array|mixed|null |
||
110 | */ |
||
111 | 30 | public function toArray() |
|
123 | |||
124 | 6 | public function __toString() |
|
132 | } |
||
133 |