protected function assertResult($descriptor, $result)
    {
        $errors = array(
            401 => "InvalidCredentials",
            402 => "PaymentRequired",
            403 => "Forbidden",
            404 => "NotFound",
            405 => "InvalidMethod",
            406 => "NotAcceptable",
            415 => "InvalidMedia",
            429 => "RateLimited",
            500 => "ServerError",
            400 => "ClientError"
        );
        if (isset($errors[$result->code])) {
            $class = $errors[$result->code];
            $class = "PortaText\\Exception\\$class";
            throw new $class($descriptor, $result);
        }
    }
protected function assertResult($descriptor, $result)
    {
        $errors = array(
            401 => "InvalidCredentials",
            402 => "PaymentRequired",
            403 => "Forbidden",
            404 => "NotFound",
            405 => "InvalidMethod",
            406 => "NotAcceptable",
            415 => "InvalidMedia",
            429 => "RateLimited",
            500 => "ServerError",
            400 => "ClientError"
        );
        if (isset($errors[$result->code])) {
            $class = $errors[$result->code];
            $class = "PortaText\\Exception\\$class";
            throw new $class($descriptor, $result);
        }
    }
protected function assertResult ( $ descriptor , $ result ) { $ errors = array ( 401 => "InvalidCredentials" , 402 => "PaymentRequired" , 403 => "Forbidden" , 404 => "NotFound" , 405 => "InvalidMethod" , 406 => "NotAcceptable" , 415 => "InvalidMedia" , 429 => "RateLimited" , 500 => "ServerError" , 400 => "ClientError" ) ; if ( isset ( $ errors [ $ result -> code ] ) ) { $ class = $ errors [ $ result -> code ] ; $ class = "PortaText\\Exception\\$class" ; throw new $ class ( $ descriptor , $ result ) ; } }
Will assert that the request finished successfuly.

@param PortaText\Command\Descriptor $descriptor The Command execution
descriptor.
@param PortaText\Command\Result $result Request execution result.

@return void
@throws PortaText\Exception\ServerError
@throws PortaText\Exception\ClientError
@throws PortaText\Exception\InvalidCredentials
@throws PortaText\Exception\PaymentRequired
@throws PortaText\Exception\Forbidden
@throws PortaText\Exception\NotFound
@throws PortaText\Exception\InvalidMedia
@throws PortaText\Exception\NotAcceptable
@throws PortaText\Exception\InvalidMethod
@throws PortaText\Exception\RateLimited
Will assert that the request finished successfuly .