PHP Classes

File: src/Collection/ValidatorCollection.php

Recommend this page to a friend!
  Packages of Derek McLean   HTML Forms   src/Collection/ValidatorCollection.php   Download  
File: src/Collection/ValidatorCollection.php
Role: Class source
Content type: text/plain
Description: Class source
Class: HTML Forms
Generate and validate submitted HTML forms
Author: By
Last change:
Date: 8 years ago
Size: 781 bytes
 

 

Contents

Class file image Download
<?php
/**
 * User: delboy1978uk
 * Date: 27/11/2016
 * Time: 13:41
 */

namespace Del\Form\Collection;

use Del\Form\Validator\ValidatorInterface;
use InvalidArgumentException;

class ValidatorCollection extends AbstractCollection implements CollectionInterface
{
    /**
     * @param ValidatorInterface $validator Pass in a validator
     * @return $this
     */
    public function append($validator)
    {
        if (!$validator instanceof ValidatorInterface) {
            throw new InvalidArgumentException('You can only append a Del\Form\Validator\ValidatorInterface.');
        }
        parent::append($validator);
        return $this;
    }

    /**
     * @return ValidatorInterface
     */
    public function current()
    {
        return parent::current();
    }
}