1 | <?php namespace Rocket\Entities; |
||
8 | class FieldCollection extends \Illuminate\Support\Collection |
||
9 | { |
||
10 | /** |
||
11 | * @var int The max items this collection can hold |
||
12 | */ |
||
13 | protected $maxItems = 1; |
||
14 | |||
15 | /** |
||
16 | * @var array The Collection configuration |
||
17 | */ |
||
18 | protected $configuration = []; |
||
19 | |||
20 | /** |
||
21 | * @var string The type of this collection |
||
22 | */ |
||
23 | protected $type; |
||
24 | |||
25 | /** |
||
26 | * @var array An array of fields that were deleted |
||
27 | */ |
||
28 | protected $deleted = []; |
||
29 | |||
30 | /** |
||
31 | * Initialize a collection with the configuration |
||
32 | * |
||
33 | * @param array $configuration |
||
34 | * @return static |
||
35 | */ |
||
36 | 93 | public static function initField($configuration = []) |
|
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 72 | public function offsetSet($key, $value) |
|
84 | |||
85 | /** |
||
86 | * Get an item at a given offset. |
||
87 | * |
||
88 | * @param mixed $key |
||
89 | * @return mixed |
||
90 | */ |
||
91 | 6 | public function offsetGet($key) |
|
95 | |||
96 | /** |
||
97 | * Unset the item at a given offset. |
||
98 | * |
||
99 | * @param string $key |
||
100 | * @return void |
||
101 | */ |
||
102 | 21 | public function offsetUnset($key) |
|
109 | |||
110 | /** |
||
111 | * Get all deleted fields |
||
112 | * |
||
113 | * @return Collection |
||
114 | */ |
||
115 | 18 | public function deleted() |
|
119 | |||
120 | 15 | public function syncOriginal() |
|
124 | |||
125 | /** |
||
126 | * Remove all items in this collection |
||
127 | * |
||
128 | * @return void |
||
129 | */ |
||
130 | 12 | public function clear() |
|
134 | |||
135 | /** |
||
136 | * Get the number of items possible in this collection. |
||
137 | * |
||
138 | * @return int |
||
139 | */ |
||
140 | 75 | public function getMaxItems() |
|
144 | |||
145 | /** |
||
146 | * As we use a field collection even if we have only one value, we use it that way. |
||
147 | * |
||
148 | * @return array|mixed|null |
||
149 | */ |
||
150 | 43 | public function toArray() |
|
162 | |||
163 | 6 | public function __toString() |
|
171 | } |
||
172 |