1 | <?php |
||
10 | class FieldCollection implements \Countable, \IteratorAggregate, \ArrayAccess, Arrayable |
||
11 | { |
||
12 | use DelegatedArrayTrait; |
||
13 | use CompositeTrait; |
||
14 | |||
15 | public function __construct() |
||
19 | |||
20 | protected function compositeTraitGetChildren() |
||
29 | |||
30 | public function add($object) |
||
34 | |||
35 | /** |
||
36 | * @param string $name |
||
37 | */ |
||
38 | public function get($name) |
||
42 | |||
43 | public function contains($name) |
||
51 | |||
52 | protected function getDelegatedStorage() |
||
56 | |||
57 | /** |
||
58 | * Get the fields value as an associative array. |
||
59 | * By default a nested array is returned. |
||
60 | * Passing true as the first parameter, a flat |
||
61 | * array will be returned, with dotted offsets |
||
62 | * as the keys. |
||
63 | * |
||
64 | * @param bool $flat |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function toArray($flat = false) |
||
77 | |||
78 | /** |
||
79 | * @return bool |
||
80 | */ |
||
81 | public function validate() |
||
98 | |||
99 | /** |
||
100 | * @param \Tacone\DataSource\AbstractDataSource $source |
||
101 | */ |
||
102 | public function from($source) |
||
110 | } |
||
111 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: