Payment_PayPal_SOAP
[ class tree: Payment_PayPal_SOAP ] [ index: Payment_PayPal_SOAP ] [ all elements ]

Class: Payment_PayPal_SOAP_ErrorException

Source Location: /Payment_PayPal_SOAP-0.5.1/Payment/PayPal/SOAP/Exceptions.php

Class Overview

Exception
   |
   --Payment_PayPal_SOAP_ErrorException

Exception thrown when the SOAP response contains one or more Error elements


Author(s):

Copyright:

  • 2008-2012 silverorange

Variables

Methods


Child classes:

Payment_PayPal_SOAP_ExpiredTokenException
Deprecated exception that used to be thrown when a request was made with an expired checkout token

Inherited Variables

Class: Exception (Internal Class)

$code
$file
$line
$message
$previous
$string
$trace

Inherited Methods

Class: Exception (Internal Class)

constructor __construct ( [$message = ], [$code = ], [$previous = ] )
getCode ( )
getFile ( )
getLine ( )
getMessage ( )
getPrevious ( )
getTrace ( )
getTraceAsString ( )
__clone ( )
__toString ( )

Class Details

[line 368]
Exception thrown when the SOAP response contains one or more Error elements

A detailed error message is present in the message field. Individual errors can be retrieved using the iterator interface. For example:

  1.  <?php
  2.  foreach ($exception as $error{
  3.      echo $error->getMessage()"\n";
  4.      echo $error->getCode()"\n";
  5.      echo $error->getSeverity()"\n";
  6.      echo $error->getType()"\n";
  7.  }
  8.  ?>

The full response object may be retrieved using the Payment_PayPal_SOAP_ErrorException::getResponse() method.



[ Top ]


Class Variables

$errors = array()

[line 383]

The errors aggregated by this exception

Type:   array


[ Top ]

$response =  null

[line 392]

The response object that contains the PayPal error(s)

Type:   stdClass


[ Top ]



Method Detail

__construct (Constructor)   [line 405]

Payment_PayPal_SOAP_ErrorException __construct( string $message, integer $code, stdClass $response)

Creates a new error exception
  • Access: public

Overrides Exception::constructor __construct ( [$message = ], [$code = ], [$previous = ] ) (parent method not documented)

Parameters:

string   $message     the exception message.
integer   $code     the exception code.
stdClass   $response     the response object that contains the PayPal error(s).

[ Top ]

addError   [line 436]

Payment_PayPal_SOAP_ErrorException addError( string|Payment_PayPal_SOAP_Error $message, [integer $code = null], [integer $severity = null], [integer $type = null])

Adds an error to this exception
  • Return: the current object for fluent interface.
  • Access: public

Parameters:

string|Payment_PayPal_SOAP_Error   $message     either an error object or a string containing the error message.
integer   $code     optional. The error code. If first argument is an object, this is ignored.
integer   $severity     optional. The error severity. If first argument is an object, this is ignored.
integer   $type     optional. The error type. If first argument is an object, this is ignored.

[ Top ]

count   [line 590]

integer count( )

Gets the number of errors aggregated by this exception

Fulfills the Countable interface.

  • Return: the number of errors aggregated by this exception
  • Access: public

[ Top ]

getIterator   [line 575]

array getIterator( )

Gets an iterator object for the errors of this exception

Fulfills the IteratorAggregate interface.

  • Return: an iterator object for the errors of this exception.
  • Access: public

[ Top ]

getResponse   [line 560]

stdClass getResponse( )

Gets the response object containing the PayPal error

Additional information about the error may be present here.

  • Return: the response object containing the PayPal error.
  • Access: public

[ Top ]

getSeverity   [line 539]

integer getSeverity( [integer $index = 0])

Gets the severity of the PayPal error

Will be one of the following:

  • Return: the severity level of the PayPal error.
  • Access: public

Parameters:

integer   $index     optional. The index of the error for which to get the severity. If not specified, the severity of the first error is returned.

[ Top ]

hasSeverity   [line 507]

boolean hasSeverity( integer $severity)

Gets whether or not this exception has an aggregated error of the specified severity

For example:

  1.  <?php
  2.  if ($e->hasSeverity(Payment_PayPal_SOAP::ERROR_ERROR)) {
  3.      echo 'Uh oh! Something went terribly wrong!';
  4.  }
  5.  ?>

  • Return: true if this exception has an aggregated error of the specified severity. Otherwise false.
  • Access: public

Parameters:

integer   $severity     the severity for which to check.

[ Top ]

hasType   [line 472]

boolean hasType( integer $type)

Gets whether or not this exception has an aggregated error of the specified type

For example:

  1.  <?php
  2.  if ($e->hasType(Payment_PayPal_SOAP_Error::TYPE_EXPIRED_TOKEN)) {
  3.      echo 'Your token has expired!';
  4.  }
  5.  ?>

  • Return: true if this exception has an aggregated error of the specified type. Otherwise false.
  • Access: public

Parameters:

integer   $type     the type for which to check.

[ Top ]


Documentation generated on Tue, 25 Sep 2012 14:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.