Fuel\Validation\Validator::getField PHP Method

getField() public method

Returns the given field
Since: 2.0
public getField ( $name ) : Fuel\Validation\FieldInterface
$name
return Fuel\Validation\FieldInterface
    public function getField($name)
    {
        if (!isset($this->fields[$name])) {
            throw new InvalidFieldException($name);
        }
        return $this->fields[$name];
    }

Usage Example

Exemplo n.º 1
0
 public function testAddMagicRule()
 {
     $this->object->addField('test')->required();
     $rules = $this->object->getField('test')->getRules();
     $this->assertInstanceOf('Fuel\\Validation\\Rule\\Required', $rules[0]);
 }