1 | <?php |
||
48 | class ItemObjectModel extends ItemList implements ItemObjectModelInterface |
||
49 | { |
||
50 | /** |
||
51 | * DOM document |
||
52 | * |
||
53 | * @var \DOMDocument |
||
54 | */ |
||
55 | protected $dom; |
||
56 | /** |
||
57 | * LinkType item cache |
||
58 | * |
||
59 | * @var ItemListInterface |
||
60 | */ |
||
61 | protected $links = null; |
||
62 | |||
63 | /** |
||
64 | * Constructor |
||
65 | * |
||
66 | * @param \DOMDocument $dom DOM document |
||
67 | * @param array $items Items |
||
68 | */ |
||
69 | 2 | public function __construct(\DOMDocument $dom, $items = []) |
|
74 | |||
75 | /** |
||
76 | * Return all link declarations of a particular type |
||
77 | * |
||
78 | * @param string|null $type Link type |
||
79 | * @param int|null $index Optional: particular index |
||
80 | * |
||
81 | * @return ItemInterface|ItemListInterface Single LinkType item or list of LinkType items |
||
82 | * @api |
||
83 | */ |
||
84 | 1 | public function link($type = null, $index = null) |
|
97 | |||
98 | /** |
||
99 | * One-time caching of LinkType items |
||
100 | */ |
||
101 | 1 | protected function cacheLinkTypeItems() |
|
111 | |||
112 | /** |
||
113 | * Return a particular link item by index |
||
114 | * |
||
115 | * @param ItemInterface[] $links Link items |
||
116 | * @param string|null $type Link type |
||
117 | * @param int $index Link item index |
||
118 | * |
||
119 | * @return ItemInterface Link item |
||
120 | * @throws OutOfBoundsException If the link index is out of bounds |
||
121 | */ |
||
122 | 1 | protected function getLinkIndex(array $links, $type, $index) |
|
134 | |||
135 | /** |
||
136 | * Return the original DOM document |
||
137 | * |
||
138 | * @return \DOMDocument DOM document |
||
139 | */ |
||
140 | 1 | public function getDom() |
|
144 | } |
||
145 |