Example #1
0
 public function setUp()
 {
     \Colada\Colada::registerFunctions();
 }
<?php

namespace Colada;

use Colada\Helpers\TypeHelper;
Colada::registerFunctions();
/**
 * General purpose collection implementation.
 *
 * @author Alexey Shockov <*****@*****.**>
 */
class IteratorCollection implements \Countable, \IteratorAggregate, Collection
{
    /**
     * @var \Iterator
     */
    protected $iterator;
    /**
     * @throws \InvalidArgumentException For \NoRewindIterator iterators.
     *
     * @param \Traversable $collection
     */
    public function __construct(\Traversable $collection = null)
    {
        if ($collection instanceof \IteratorAggregate) {
            $collection = $collection->getIterator();
        }
        // Traversable?
        if (!$collection instanceof \Iterator && !$collection instanceof \IteratorAggregate) {
            $collection = new \IteratorIterator($collection);
        }
Example #3
0
function use_colada()
{
    require_once __DIR__ . '/globals.php';
    \Colada\Colada::registerFunctions();
}