public function getFirstError(string $key, string $group = null)
    {
        if (!empty($group)) {
            if (isset($this->errors[$group][$key])) {
                $first = array_slice($this->errors[$group][$key], 0, 1);

                return array_shift($first);
            }
        }

        if (isset($this->errors[$key])) {
            $first = array_slice($this->errors[$key], 0, 1);

            return array_shift($first);
        }

        return '';
    }
public function getFirstError(string $key, string $group = null)
    {
        if (!empty($group)) {
            if (isset($this->errors[$group][$key])) {
                $first = array_slice($this->errors[$group][$key], 0, 1);

                return array_shift($first);
            }
        }

        if (isset($this->errors[$key])) {
            $first = array_slice($this->errors[$key], 0, 1);

            return array_shift($first);
        }

        return '';
    }
public function getFirstError ( string $ key , string $ group = null ) { if ( ! empty ( $ group ) ) { if ( isset ( $ this -> errors [ $ group ] [ $ key ] ) ) { $ first = array_slice ( $ this -> errors [ $ group ] [ $ key ] , 0 , 1 ) ; return array_shift ( $ first ) ; } } if ( isset ( $ this -> errors [ $ key ] ) ) { $ first = array_slice ( $ this -> errors [ $ key ] , 0 , 1 ) ; return array_shift ( $ first ) ; } return '' ; }
Gets the first error of a parameter.

@param string      $key
@param string|null $group

@return string
Gets the first error of a parameter .