public function getErrorData($key = null)
    {
        if ($this->isSuccessful()) {
            return null;
        }
        // get error data (array in data)
        $data = isset($this->getData('data')[0]) ? $this->getData('data')[0] : null;
        if ($key) {
            return isset($data[$key]) ? $data[$key] : null;
        }
        return $data;
    }
public function getErrorData($key = null)
    {
        if ($this->isSuccessful()) {
            return null;
        }
        // get error data (array in data)
        $data = isset($this->getData('data')[0]) ? $this->getData('data')[0] : null;
        if ($key) {
            return isset($data[$key]) ? $data[$key] : null;
        }
        return $data;
    }
public function getErrorData ( $ key = null ) { if ( $ this -> isSuccessful ( ) ) { return null ; } // get error data (array in data) $ data = isset ( $ this -> getData ( 'data' ) [ 0 ] ) ? $ this -> getData ( 'data' ) [ 0 ] : null ; if ( $ key ) { return isset ( $ data [ $ key ] ) ? $ data [ $ key ] : null ; } return $ data ; }
Get error data from response
@param  string       $key Optional data key
@return string|array      Response error item or all data if no key
Get error data from response