You are here

abstract class AcsfMessageResponse in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 src/AcsfMessageResponse.php \Drupal\acsf\AcsfMessageResponse

AcsfMessageResponse.

Hierarchy

Expanded class hierarchy of AcsfMessageResponse

1 file declares its use of AcsfMessageResponse
AcsfMessageResponseUnitTest.inc in tests/AcsfMessageResponseUnitTest.inc

File

src/AcsfMessageResponse.php, line 8

Namespace

Drupal\acsf
View source
abstract class AcsfMessageResponse {

  /**
   * The endpoint on the remote service.
   *
   * @var string
   */
  public $endpoint;

  /**
   * The response code from the remote call.
   *
   * @var mixed
   */
  public $code;

  /**
   * The body of the response.
   *
   * @var mixed
   */
  public $body;

  /**
   * Constructor.
   *
   * @param string $endpoint
   *   The endpoint on the remote service.
   * @param mixed $code
   *   The response code from the remote call.
   * @param mixed $body
   *   The body of the response.
   */
  public function __construct($endpoint, $code, $body) {
    if (empty($endpoint) || $code === NULL || $body === NULL) {
      throw new AcsfMessageMalformedResponseException('A response must contain an endpoint, a return code and a response body.');
    }
    $this->endpoint = $endpoint;
    $this->code = $code;
    $this->body = $body;
  }

  /**
   * Defines whether or not the call failed.
   *
   * Client code needs to analyze the response and determine failure.
   */
  public abstract function failed();

}

Members

Namesort descending Modifiers Type Description Overrides
AcsfMessageResponse::$body public property The body of the response.
AcsfMessageResponse::$code public property The response code from the remote call.
AcsfMessageResponse::$endpoint public property The endpoint on the remote service.
AcsfMessageResponse::failed abstract public function Defines whether or not the call failed. 2
AcsfMessageResponse::__construct public function Constructor.