1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\DataDefinition\Definition\View;
14:
15: use DcGeneral\DataDefinition\Definition\View\Panel\ElementInformationInterface;
16:
17: /**
18: * This interface describes a panel row definition.
19: *
20: * @package DcGeneral\DataDefinition\Definition\View
21: */
22: interface PanelRowInterface extends \IteratorAggregate
23: {
24: /**
25: * Return the names of the contained panel elements.
26: *
27: * This will return the following for example:
28: * array('filter[prop1]', 'filter[prop2]', 'search', 'limit')
29: *
30: * @return array
31: */
32: public function getElements();
33:
34: /**
35: * Add an element at the end of the row or - optionally - at the given position.
36: *
37: * If the given position is zero or any other positive value, the element will get placed at the given position.
38: * If the index is negative or greater than the total amount of rows present, the new element will get placed at the
39: * end of the list.
40: *
41: * @param ElementInformationInterface $element The element to add.
42: *
43: * @param int $index Target position for the element.
44: *
45: * @return PanelRowInterface
46: */
47: public function addElement(ElementInformationInterface $element, $index = -1);
48:
49: /**
50: * Remove the element with the given index (if numeric) or name (if string).
51: *
52: * @param int|string|ElementInformationInterface $indexOrNameOrInstance Element name or numeric index in the row.
53: *
54: * @return PanelRowInterface
55: */
56: public function deleteElement($indexOrNameOrInstance);
57:
58: /**
59: * Check if the given element instance or an element with the given name is in the row.
60: *
61: * Throws an exception when an invalid value has been passed.
62: *
63: * @param ElementInformationInterface|string $instanceOrName The element instance or the name of an element to check.
64: *
65: * @return bool
66: */
67: public function hasElement($instanceOrName);
68:
69: /**
70: * Retrieve the amount of elements.
71: *
72: * @return int
73: */
74: public function getCount();
75:
76: /**
77: * Retrieve the element with the given index (if numeric) or name (if string).
78: *
79: * @param int|string $indexOrName Element name or numeric index in the row.
80: *
81: * @return ElementInformationInterface
82: */
83: public function getElement($indexOrName);
84:
85: /**
86: * Retrieve an external iterator.
87: *
88: * @link http://php.net/manual/en/iteratoraggregate.getiterator.php
89: *
90: * @return ElementInformationInterface[]
91: */
92: public function getIterator();
93: }
94: