src/Validation.php
public function getErrorCount($field = null) {
        if ($field === null) {
            return iterator_count($this->getRawErrors());
        } elseif (empty($this->errors[$field])) {
            return 0;
        } else {
            return count($this->errors[$field]);
        }
    }
public function getErrorCount($field = null) {
        if ($field === null) {
            return iterator_count($this->getRawErrors());
        } elseif (empty($this->errors[$field])) {
            return 0;
        } else {
            return count($this->errors[$field]);
        }
    }
public function getErrorCount ( $ field = null ) { if ( $ field === null ) { return iterator_count ( $ this -> getRawErrors ( ) ) ; } elseif ( empty ( $ this -> errors [ $ field ] ) ) { return 0 ; } else { return count ( $ this -> errors [ $ field ] ) ; } }
Get the error count, optionally for a particular field.

@param string|null $field The name of a field or an empty string for all errors.
@return int Returns the error count.
Get the error count optionally for a particular field .