1 | <?php |
||
17 | trait ElementsAwareTrait |
||
18 | { |
||
19 | /** |
||
20 | * @var \ArrayIterator |
||
21 | */ |
||
22 | protected $elements; |
||
23 | |||
24 | /** |
||
25 | * initialize the elements property before use |
||
26 | */ |
||
27 | 98 | protected function initElements() |
|
31 | |||
32 | /** |
||
33 | * @return ElementInterface |
||
34 | */ |
||
35 | 21 | public function newElement() |
|
39 | |||
40 | /** |
||
41 | * @param string $name element name |
||
42 | * @return mixed |
||
43 | */ |
||
44 | 4 | public function getValue($name) |
|
52 | |||
53 | /** |
||
54 | * @param string $name element name |
||
55 | * @return ElementIterator |
||
56 | */ |
||
57 | 16 | public function getElementIterator($name) |
|
61 | |||
62 | /** |
||
63 | * @param string $name element name |
||
64 | * @return boolean true if the element exists |
||
65 | */ |
||
66 | 4 | public function hasElement($name) |
|
72 | |||
73 | /** |
||
74 | * @param ElementInterface $element |
||
75 | * @return $this |
||
76 | */ |
||
77 | 25 | public function addElement(ElementInterface $element) |
|
83 | |||
84 | /** |
||
85 | * Returns all the item's optional elements |
||
86 | * @return \ArrayIterator |
||
87 | */ |
||
88 | 14 | public function getAllElements() |
|
92 | |||
93 | /** |
||
94 | * Returns the item's optional elements tag names |
||
95 | * @return array |
||
96 | */ |
||
97 | 7 | public function listElements() |
|
103 | |||
104 | /** |
||
105 | * @return \Generator |
||
106 | */ |
||
107 | 4 | public function getElementsGenerator() |
|
115 | |||
116 | } |
||
117 |