ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
TraversableString.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2014 OpenSky Project Inc
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Assetic\Util;
13
19class TraversableString implements \IteratorAggregate, \Countable
20{
21 private $one;
22 private $many;
23
24 public function __construct($one, array $many)
25 {
26 $this->one = $one;
27 $this->many = $many;
28 }
29
30 public function getIterator()
31 {
32 return new \ArrayIterator($this->many);
33 }
34
35 public function count()
36 {
37 return count($this->many);
38 }
39
40 public function __toString()
41 {
42 return (string) $this->one;
43 }
44}
An object that can be used as either a string or array.
An exception for terminatinating execution or to throw for unit testing.