/usr/share/php/Horde/View/Helper/Text/Cycle.php is in php-horde-view 2.0.6-3.
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 | <?php
/**
* Copyright 2007 Maintainable Software, LLC
* Copyright 2006-2016 Horde LLC (http://www.horde.org/)
*
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd
* @category Horde
* @package View
* @subpackage Helper
*/
/**
* View helpers for URLs
*
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd
* @category Horde
* @package View
* @subpackage Helper
*/
class Horde_View_Helper_Text_Cycle
{
/**
* Array of values to cycle through
* @var array
*/
private $_values;
/**
* Construct a new cycler
*
* @param array $values Values to cycle through
*/
public function __construct($values)
{
if (func_num_args() != 1 || !is_array($values)) {
throw new InvalidArgumentException();
}
if (count($values) < 2) {
throw new InvalidArgumentException('must have at least two values');
}
$this->_values = $values;
$this->reset();
}
/**
* Returns the current element in the cycle
* and advance the cycle
*
* @return mixed Current element
*/
public function __toString()
{
$value = next($this->_values);
return strval(($value !== false) ? $value : reset($this->_values));
}
/**
* Reset the cycle
*/
public function reset()
{
end($this->_values);
}
/**
* Returns the values of this cycler.
*
* @return array
*/
public function getValues()
{
return $this->_values;
}
}
|