src/Component.php
public function certified()
    {
        if (!is_null($this->submitted)) {
            return $this->certified; // so we don't overwrite error messages
        }
        $errors = array();
        $this->values = array();
        $this->submitted = false;
        foreach ($this->data as $field => $data) {
            if (!is_null($data['value'])) {
                $this->submitted = true;
            }
            if (!empty($data['value'])) {
                $this->values[$field] = $data['value'];
            } elseif (strpos($field, '[]') !== false) {
                $this->values[$field] = array();
            } else {
                $this->values[$field] = (isset($data['rules']['default'])) ? $data['rules']['default'] : '';
            }
            if (!is_null($data['error'])) {
                $errors[$field] = $data['error'];
            }
        }
        if ($this->submitted) {
            $submitted = array();
            foreach ($this->data as $field => $data) {
                $value = &$submitted;
                foreach ($data['field'] as $index) {
                    $value = &$value[$index];
                }
                $value = $this->values[$field];
                if (isset($data['rules']['required']) && empty($value)) {
                    $errors[$field] = $this->errorMessage('required');
                } elseif (!isset($errors[$field])) {
                    if (isset($data['rules']['equalTo']) && $value != $this->value($data['rules']['equalTo'])) {
                        $errors[$field] = $this->errorMessage('equalTo');
                    } elseif (isset($data['rules']['notEqualTo']) && $value == $this->value($data['rules']['notEqualTo'])) {
                        $errors[$field] = $this->errorMessage('notEqualTo');
                    }
                }
            }
            $this->certified = (!empty($errors)) ? false : $submitted;
        }
        $this->errors = $errors;

        return $this->certified;
    }
public function certified()
    {
        if (!is_null($this->submitted)) {
            return $this->certified; // so we don't overwrite error messages
        }
        $errors = array();
        $this->values = array();
        $this->submitted = false;
        foreach ($this->data as $field => $data) {
            if (!is_null($data['value'])) {
                $this->submitted = true;
            }
            if (!empty($data['value'])) {
                $this->values[$field] = $data['value'];
            } elseif (strpos($field, '[]') !== false) {
                $this->values[$field] = array();
            } else {
                $this->values[$field] = (isset($data['rules']['default'])) ? $data['rules']['default'] : '';
            }
            if (!is_null($data['error'])) {
                $errors[$field] = $data['error'];
            }
        }
        if ($this->submitted) {
            $submitted = array();
            foreach ($this->data as $field => $data) {
                $value = &$submitted;
                foreach ($data['field'] as $index) {
                    $value = &$value[$index];
                }
                $value = $this->values[$field];
                if (isset($data['rules']['required']) && empty($value)) {
                    $errors[$field] = $this->errorMessage('required');
                } elseif (!isset($errors[$field])) {
                    if (isset($data['rules']['equalTo']) && $value != $this->value($data['rules']['equalTo'])) {
                        $errors[$field] = $this->errorMessage('equalTo');
                    } elseif (isset($data['rules']['notEqualTo']) && $value == $this->value($data['rules']['notEqualTo'])) {
                        $errors[$field] = $this->errorMessage('notEqualTo');
                    }
                }
            }
            $this->certified = (!empty($errors)) ? false : $submitted;
        }
        $this->errors = $errors;

        return $this->certified;
    }
public function certified ( ) { if ( ! is_null ( $ this -> submitted ) ) { return $ this -> certified ; // so we don't overwrite error messages } $ errors = array ( ) ; $ this -> values = array ( ) ; $ this -> submitted = false ; foreach ( $ this -> data as $ field => $ data ) { if ( ! is_null ( $ data [ 'value' ] ) ) { $ this -> submitted = true ; } if ( ! empty ( $ data [ 'value' ] ) ) { $ this -> values [ $ field ] = $ data [ 'value' ] ; } elseif ( strpos ( $ field , '[]' ) !== false ) { $ this -> values [ $ field ] = array ( ) ; } else { $ this -> values [ $ field ] = ( isset ( $ data [ 'rules' ] [ 'default' ] ) ) ? $ data [ 'rules' ] [ 'default' ] : '' ; } if ( ! is_null ( $ data [ 'error' ] ) ) { $ errors [ $ field ] = $ data [ 'error' ] ; } } if ( $ this -> submitted ) { $ submitted = array ( ) ; foreach ( $ this -> data as $ field => $ data ) { $ value = & $ submitted ; foreach ( $ data [ 'field' ] as $ index ) { $ value = & $ value [ $ index ] ; } $ value = $ this -> values [ $ field ] ; if ( isset ( $ data [ 'rules' ] [ 'required' ] ) && empty ( $ value ) ) { $ errors [ $ field ] = $ this -> errorMessage ( 'required' ) ; } elseif ( ! isset ( $ errors [ $ field ] ) ) { if ( isset ( $ data [ 'rules' ] [ 'equalTo' ] ) && $ value != $ this -> value ( $ data [ 'rules' ] [ 'equalTo' ] ) ) { $ errors [ $ field ] = $ this -> errorMessage ( 'equalTo' ) ; } elseif ( isset ( $ data [ 'rules' ] [ 'notEqualTo' ] ) && $ value == $ this -> value ( $ data [ 'rules' ] [ 'notEqualTo' ] ) ) { $ errors [ $ field ] = $ this -> errorMessage ( 'notEqualTo' ) ; } } } $ this -> certified = ( ! empty ( $ errors ) ) ? false : $ submitted ; } $ this -> errors = $ errors ; return $ this -> certified ; }
This method goes through all of the fields you set above, determines if the form has been sent, and picks out any errors.

@return false|array Returns an array of validated and filtered form values for every ``$validator->set('field')`` IF the form was submitted (ie. at least one field has it's $_GET or $_POST counterpart), AND there were no errors.

```php
if ($vars = $validator->certified()) {
// process $vars
}
```
This method goes through all of the fields you set above determines if the form has been sent and picks out any errors .