You are here

class BuildHookDetails in Build Hooks 8.2

Same name and namespace in other branches
  1. 3.x src/BuildHookDetails.php \Drupal\build_hooks\BuildHookDetails

Class BuildHookDetails.

Holds information to make the call to an external service for a build hook.

Hierarchy

Expanded class hierarchy of BuildHookDetails

8 files declare their use of BuildHookDetails
BitbucketManager.php in modules/build_hooks_bitbucket/src/BitbucketManager.php
BitbucketManagerTest.php in modules/build_hooks_bitbucket/tests/src/Unit/BitbucketManagerTest.php
BuildHookDetailsDeprecatedTest.php in tests/src/Unit/BuildHookDetailsDeprecatedTest.php
CircleCiManager.php in modules/build_hooks_circleci/src/CircleCiManager.php
CircleV2.php in modules/build_hooks_circleci/src/Plugin/FrontendEnvironment/CircleV2.php

... See full list

File

src/BuildHookDetails.php, line 10

Namespace

Drupal\build_hooks
View source
class BuildHookDetails {

  /**
   * The url to call.
   *
   * @var string
   */
  protected $url;

  /**
   * The method to use (POST,GET,...)
   *
   * @var string
   */
  protected $method;

  /**
   * The options of the request.
   *
   * @var array
   */
  protected $options;

  /**
   * BuildHookDetails constructor.
   */
  public function __construct() {
    $this->url = '';
    $this->options = [];
    $this->method = '';
  }

  /**
   * Get the url.
   *
   * @return string
   *   The url.
   */
  public function getUrl() : string {
    return $this->url;
  }

  /**
   * Set the url.
   *
   * @param string $url
   *   The url.
   */
  public function setUrl(string $url) {
    $this->url = $url;
  }

  /**
   * Get the method.
   *
   * @return string
   *   The method.
   */
  public function getMethod() : string {
    return $this->method;
  }

  /**
   * Set the method.
   *
   * @param string $method
   *   The method.
   */
  public function setMethod(string $method) {
    $this->method = $method;
  }

  /**
   * Get the body.
   *
   * @return array
   *   The body.
   *
   * @deprecated in build_hooks:8.x-2.4 and is removed from build_hooks:8.x-3.0.
   *   The getBody() method is depcrecated. Use getOptions() method instead.
   *
   * @see https://www.drupal.org/node/3173753
   */
  public function getBody() : array {
    @trigger_error(__METHOD__ . ' is deprecated in build_hooks:8.x-2.4 and is removed from build_hooks:8.x-3.0. Instead, you should use Drupal\\build_hooks\\BuildHookDetails::getOptions. See https://www.drupal.org/node/3173753', E_USER_DEPRECATED);
    return $this->options;
  }

  /**
   * Get the options.
   *
   * @return array
   *   The options.
   */
  public function getOptions() : array {
    return $this->options;
  }

  /**
   * Set the body.
   *
   * @param array $body
   *   The array.
   *
   * @deprecated in build_hooks:8.x-2.4 and is removed from build_hooks:8.x-3.0.
   *   The setBody() method is depcrecated. Use setOptions() method instead.
   *
   * @see https://www.drupal.org/node/3173753
   */
  public function setBody(array $body) {
    @trigger_error(__METHOD__ . ' is deprecated in build_hooks:8.x-2.4 and is removed from build_hooks:8.x-3.0. Instead, you should use Drupal\\build_hooks\\BuildHookDetails::setOptions. See https://www.drupal.org/node/3173753', E_USER_DEPRECATED);
    $this->options = $body;
  }

  /**
   * Set the options.
   *
   * @param array $options
   *   The array.
   */
  public function setOptions(array $options) {
    $this->options = $options;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BuildHookDetails::$method protected property The method to use (POST,GET,...)
BuildHookDetails::$options protected property The options of the request.
BuildHookDetails::$url protected property The url to call.
BuildHookDetails::getBody Deprecated public function Get the body.
BuildHookDetails::getMethod public function Get the method.
BuildHookDetails::getOptions public function Get the options.
BuildHookDetails::getUrl public function Get the url.
BuildHookDetails::setBody Deprecated public function Set the body.
BuildHookDetails::setMethod public function Set the method.
BuildHookDetails::setOptions public function Set the options.
BuildHookDetails::setUrl public function Set the url.
BuildHookDetails::__construct public function BuildHookDetails constructor.