public function error($error, $defaultStatusCode = null, array $headers = [])
    {
        if (is_string($error)) {
            $error = $this->api->getErrors()->error($error);
        } else if (is_array($error)) {
            $error = Error::create($error);
        }

        if (!$error instanceof ErrorInterface) {
            throw new \InvalidArgumentException('Expecting a string, array or error object.');
        }

        return $this->errors($error, $defaultStatusCode, $headers);
    }
public function error($error, $defaultStatusCode = null, array $headers = [])
    {
        if (is_string($error)) {
            $error = $this->api->getErrors()->error($error);
        } else if (is_array($error)) {
            $error = Error::create($error);
        }

        if (!$error instanceof ErrorInterface) {
            throw new \InvalidArgumentException('Expecting a string, array or error object.');
        }

        return $this->errors($error, $defaultStatusCode, $headers);
    }
public function error ( $ error , $ defaultStatusCode = null , array $ headers = [ ] ) { if ( is_string ( $ error ) ) { $ error = $ this -> api -> getErrors ( ) -> error ( $ error ) ; } else if ( is_array ( $ error ) ) { $ error = Error :: create ( $ error ) ; } if ( ! $ error instanceof ErrorInterface ) { throw new \ InvalidArgumentException ( 'Expecting a string, array or error object.' ) ; } return $ this -> errors ( $ error , $ defaultStatusCode , $ headers ) ; }
Create a response containing a single error.

@param string|array|ErrorInterface $error
@param int|null $defaultStatusCode
@param array $headers
@return mixed
Create a response containing a single error .