public function getErrorsByKey($key)
    {
        if (!is_string($key)) {
            throw new \Exception('Key must be a string');
        }
        
        $errors = array_filter($this->errors, function ($el) use ($key) {
            return $el['key'] === $key;
        });
        
        return $errors;
    }
public function getErrorsByKey($key)
    {
        if (!is_string($key)) {
            throw new \Exception('Key must be a string');
        }
        
        $errors = array_filter($this->errors, function ($el) use ($key) {
            return $el['key'] === $key;
        });
        
        return $errors;
    }
public function getErrorsByKey ( $ key ) { if ( ! is_string ( $ key ) ) { throw new \ Exception ( 'Key must be a string' ) ; } $ errors = array_filter ( $ this -> errors , function ( $ el ) use ( $ key ) { return $ el [ 'key' ] === $ key ; } ) ; return $ errors ; }
Get list of errors by specified key.

@param string $key

@return array

@throws \Exception
Get list of errors by specified key .