You are here

AcsfMessageResponse.php in Acquia Cloud Site Factory Connector 8

Same filename and directory in other branches
  1. 8.2 src/AcsfMessageResponse.php

Namespace

Drupal\acsf

File

src/AcsfMessageResponse.php
View source
<?php

namespace Drupal\acsf;


/**
 * AcsfMessageResponse.
 */
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();

}

Classes

Namesort descending Description
AcsfMessageResponse AcsfMessageResponse.