/usr/share/php/Horde/Xml/Element/List.php is in php-horde-xml-element 2.0.4-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | <?php
/**
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Xml_Element
*/
/**
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Xml_Element
*/
abstract class Horde_Xml_Element_List extends Horde_Xml_Element implements Countable, Iterator
{
/**
* Cache of list items.
* @var array
*/
protected $_listItems;
/**
* Current index on the collection of list items for the Iterator
* implementation.
* @var integer
*/
protected $_listItemIndex = 0;
/**
* The classname for individual list items.
* @var string
*/
protected $_listItemClassName = 'Horde_Xml_Element';
/**
* Ensure that $_listItems is populated by calling the concrete implementation's
* _buildItemsCache() method.
*/
public function __wakeup()
{
parent::__wakeup();
$this->_listItems = $this->_buildListItemCache();
}
/**
* Called by __wakeup to cache list items. Must be implemented in the
* extending class to return the array of list items.
* @return array
*/
abstract protected function _buildListItemCache();
/**
* Get the number of items in this list.
*
* @return integer Item count.
*/
public function count()
{
return count($this->_listItems);
}
/**
* Required by the Iterator interface.
*
* @internal
*/
public function rewind()
{
$this->_listItemIndex = 0;
}
/**
* Required by the Iterator interface.
*
* @internal
*
* @return mixed The current row, or null if no rows.
*/
public function current()
{
return new $this->_listItemClassName(
$this->_listItems[$this->_listItemIndex]);
}
/**
* Required by the Iterator interface.
*
* @internal
*
* @return mixed The current row number (starts at 0), or null if no rows
*/
public function key()
{
return $this->_listItemIndex;
}
/**
* Required by the Iterator interface.
*
* @internal
*
* @return mixed The next row, or null if no more rows.
*/
public function next()
{
++$this->_listItemIndex;
}
/**
* Required by the Iterator interface.
*
* @internal
*
* @return boolean Whether the iteration is valid
*/
public function valid()
{
return (0 <= $this->_listItemIndex && $this->_listItemIndex < count($this->_listItems));
}
}
|