Location: PHPKode > scripts > Redstart Templating > Redstart-Templating-master/Redstart/Templating/Escape/EscapeList.php
<?php

namespace Redstart\Templating\Escape;

/**
 * Escape List 
 * 
 * @package Redstart    
 * @subpackage Redstart_Templating_Escape
 *
 * @author Hyyan Abo Fakher
 * @since Redstart 1.0
 * @version 1.0
 */
class EscapeList implements EscapeListInterface {

    protected $listeners = array();

    /**
     * Constrcut New Escape List
     * @param array $listeners array of escape listener
     */
    public function __construct(array $listeners = array()) {
        $this->setEscape($listeners);
    }

    /**
     * Add new escape Listener
     * @param mixed $listener
     */
    public function addEscape($listener) {
        $this->listeners[] = $listener;
    }

    /**
     * Add array of escape listeners
     * @param array $listeners
     */
    public function setEscape(array $listeners) {
        foreach ($listeners as $listener) {
            $this->addEscape($listener);
        }
    }

    /**
     * Add Escape List
     * @param \Redstart\Templating\Escape\EscapeListInterface $list
     */
    public function addEscapeList(EscapeListInterface $list) {
        $this->setEscape(iterator_to_array($list->getIterator()));
    }

    /**
     * Clear all listeners
     */
    public function clear() {
        $this->listeners = array();
    }

    /**
     * Get listeners number
     * @return integer
     */
    public function count() {
        return count($this->listeners);
    }

    /**
     * Serialize the escape list
     * @return string
     */
    public function serialize() {
        return serialize($this->listeners);
    }

    /**
     * Unserialize the escape list
     * @param string $serialized
     */
    public function unserialize($serialized) {
        $this->listeners = unserialize($serialized);
    }

    /**
     * Get Escape List Iterator
     * @return \ArrayIterator
     */
    public function getIterator() {
        return new \ArrayIterator($this->listeners);
    }

}

Return current item: Redstart Templating