src/DataObject.php
public function getError(?int $i=null): string
  {
    if ( null === $i ){
      $error = end($this->errors);
    }
    else {
      if ( !array_key_exists($i, $this->errors) ){
        return false;
      }
      
      $error = $this->errors[$i];
    }
    
    if ( $error instanceof Exception ){
      return $error->getMessage();
    }
    
    return $error;
  }
public function getError(?int $i=null): string
  {
    if ( null === $i ){
      $error = end($this->errors);
    }
    else {
      if ( !array_key_exists($i, $this->errors) ){
        return false;
      }
      
      $error = $this->errors[$i];
    }
    
    if ( $error instanceof Exception ){
      return $error->getMessage();
    }
    
    return $error;
  }
public function getError ( ? int $ i = null ) : string { if ( null === $ i ) { $ error = end ( $ this -> errors ) ; } else { if ( ! array_key_exists ( $ i , $ this -> errors ) ) { return false ; } $ error = $ this -> errors [ $ i ] ; } if ( $ error instanceof Exception ) { return $ error -> getMessage ( ) ; } return $ error ; }
Get an error message

@param  integer  $i         Option error index
@return string   Error message
Get an error message