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 ElementIterator |
||
43 | */ |
||
44 | 16 | public function getElementIterator($name) |
|
48 | |||
49 | /** |
||
50 | * @param string $name element name |
||
51 | * @return boolean true if the element exists |
||
52 | */ |
||
53 | 4 | public function hasElement($name) |
|
59 | |||
60 | /** |
||
61 | * @param ElementInterface $element |
||
62 | * @return $this |
||
63 | */ |
||
64 | 25 | public function addElement(ElementInterface $element) |
|
70 | |||
71 | /** |
||
72 | * Returns all the item's optional elements |
||
73 | * @return \ArrayIterator |
||
74 | */ |
||
75 | 14 | public function getAllElements() |
|
79 | |||
80 | /** |
||
81 | * Returns the item's optional elements tag names |
||
82 | * @return array |
||
83 | */ |
||
84 | 7 | public function listElements() |
|
90 | |||
91 | /** |
||
92 | * @return \Generator |
||
93 | */ |
||
94 | 4 | public function getElementsGenerator() |
|
102 | |||
103 | } |
||
104 |