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: /**
16: * This interface describes a panel row collection.
17: *
18: * @package DcGeneral\DataDefinition\Definition\View
19: */
20: interface PanelRowCollectionInterface extends \IteratorAggregate
21: {
22: /**
23: * Return rows of panel element names.
24: *
25: * This will return the following for example:
26: * array(array('filter[prop1]', 'filter[prop2]'), array('search', 'limit'))
27: *
28: * Note that each panel element decides its name on its own.
29: *
30: * @return array
31: */
32: public function getRows();
33:
34: /**
35: * Add a new row - optionally at the given position.
36: *
37: * If the given position is zero or any other positive value, the new row will get placed at the given position.
38: * If the index is negative or greater than the total amount of rows present, the new row will get placed at the end
39: * of the list.
40: *
41: * @param int $index Target position for the new row.
42: *
43: * @return PanelRowInterface
44: */
45: public function addRow($index = -1);
46:
47: /**
48: * Delete a row from the collection.
49: *
50: * @param int $index Remove the row with the given index.
51: *
52: * @return PanelRowCollectionInterface
53: */
54: public function deleteRow($index);
55:
56: /**
57: * Retrieve the amount of rows.
58: *
59: * @return int
60: */
61: public function getRowCount();
62:
63: /**
64: * Retrieve the row at the given position.
65: *
66: * If the given index is out of bounds (less than zero or greater than the amount of rows) an exception is fired.
67: *
68: * @param int $index Position of the row.
69: *
70: * @return PanelRowInterface
71: */
72: public function getRow($index);
73:
74: /**
75: * Retrieve an external iterator.
76: *
77: * @link http://php.net/manual/en/iteratoraggregate.getiterator.php
78: *
79: * @return PanelRowInterface[]
80: */
81: public function getIterator();
82: }
83: