PHP Classes

File: src/Collection/FieldCollection.php

Recommend this page to a friend!
  Packages of Derek McLean   HTML Forms   src/Collection/FieldCollection.php   Download  
File: src/Collection/FieldCollection.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: 784 bytes
 

 

Contents

Class file image Download
<?php
/**
 * User: delboy1978uk
 * Date: 19/11/2016
 * Time: 12:18
 */

namespace Del\Form\Collection;

use Del\Form\Field\FieldInterface;

class FieldCollection extends AbstractCollection implements CollectionInterface
{
    /**
     * @param $name
     * @return FieldInterface|null
     */
    public function findByName($name)
    {
        $this->rewind();
        while ($this->valid()) {
            /** @var FieldInterface $field */
            $field = $this->current();
            if ($field->getName() == $name) {
                return $field;
            }
            $this->next();
        }
        $this->rewind();
        return null;
    }

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