source: sandbox/newExpressoMail/newExpressoMail/Assetic/Util/TraversableString.php @ 7265

Revision 7265, 878 bytes checked in by gustavo, 12 years ago (diff)

Ticket #0000 - Criado novo modulo para o desenvolvimento do novo ExpressoMail?

  • Property svn:executable set to *
Line 
1<?php
2
3/*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2012 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
14/**
15 * An object that can be used as either a string or array.
16 *
17 * @author Kris Wallsmith <kris.wallsmith@gmail.com>
18 */
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}
Note: See TracBrowser for help on using the repository browser.