You are here

interface RequestInterface in RESTful 7.2

Hierarchy

Expanded class hierarchy of RequestInterface

All classes that implement RequestInterface

75 files declare their use of RequestInterface
AccessToken__1_0.php in modules/restful_token_auth/src/Plugin/resource/AccessToken__1_0.php
Contains Drupal\restful_token_auth\Plugin\resource\AccessToken__1_0.
Articles__1_0.php in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_0.php
Contains \Drupal\restful_example\Plugin\resource\node\article\v1\Articles__1_0.
Articles__1_1.php in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_1.php
Contains \Drupal\restful_example\Plugin\resource\node\article\v1\Articles__1_1.
Authentication.php in src/Plugin/authentication/Authentication.php
Contains \Drupal\restful\Plugin\authentication\Authentication
AuthenticationInterface.php in src/Plugin/authentication/AuthenticationInterface.php
Contains \Drupal\restful\Plugin\authentication\Authentication

... See full list

File

src/Http/RequestInterface.php, line 10
Contains \Drupal\restful\Http\RequestInterface.

Namespace

Drupal\restful\Http
View source
interface RequestInterface {
  const HEADER_CLIENT_IP = 'client_ip';
  const HEADER_CLIENT_HOST = 'client_host';
  const HEADER_CLIENT_PROTO = 'client_proto';
  const HEADER_CLIENT_PORT = 'client_port';
  const METHOD_HEAD = 'HEAD';
  const METHOD_GET = 'GET';
  const METHOD_POST = 'POST';
  const METHOD_PUT = 'PUT';
  const METHOD_PATCH = 'PATCH';
  const METHOD_DELETE = 'DELETE';
  const METHOD_PURGE = 'PURGE';
  const METHOD_OPTIONS = 'OPTIONS';
  const METHOD_TRACE = 'TRACE';
  const METHOD_CONNECT = 'CONNECT';

  /**
   * Creates a new request with values from PHP's super globals.
   *
   * @return RequestInterface
   *   Request A Request instance
   */
  public static function createFromGlobals();

  /**
   * Creates a Request based on a given URI and configuration.
   *
   * @param string $path
   *   The requested path.
   * @param array $query
   *   The query string parameters being passed.
   * @param string $method
   *   A valid HTTP method
   * @param HttpHeaderBag $headers
   *   The headers for the request
   * @param bool $via_router
   *   Boolean indicating that if the requested was created via the Drupal's
   *   menu router.
   * @param string $csrf_token
   *   A CSRF token that applies to the current request.
   * @param array $cookies
   *   An array of key value pairs containing information about the cookies.
   * @param array $files
   *   An array of key value pairs containing information about the files.
   * @param array $server
   *   An array of key value pairs containing information about the server.
   *
   * @return RequestInterface Request
   *   A Request instance
   */
  public static function create($path, array $query = array(), $method = 'GET', HttpHeaderBag $headers = NULL, $via_router = FALSE, $csrf_token = NULL, array $cookies = array(), array $files = array(), array $server = array());

  /**
   * Determines if the HTTP method represents a write operation.
   *
   * @param string $method
   *   The method name.
   *
   * @return boolean
   *   TRUE if it is a write operation. FALSE otherwise.
   */
  public static function isWriteMethod($method);

  /**
   * Determines if the HTTP method represents a read operation.
   *
   * @param string $method
   *   The method name.
   *
   * @return boolean
   *   TRUE if it is a read operation. FALSE otherwise.
   */
  public static function isReadMethod($method);

  /**
   * Determines if the HTTP method is one of the known methods.
   *
   * @param string $method
   *   The method name.
   *
   * @return boolean
   *   TRUE if it is a known method. FALSE otherwise.
   */
  public static function isValidMethod($method);

  /**
   * Helper method to know if the current request is for a list.
   *
   * @param string $resource_path
   *   The resource path without any prefixes.
   *
   * @return boolean
   *   TRUE if the request is for a list. FALSE otherwise.
   */
  public function isListRequest($resource_path);

  /**
   * Parses the body string.
   *
   * @return array
   *   The parsed body.
   */
  public function getParsedBody();

  /**
   * Parses the input data provided via URL params.
   *
   * @return array
   *   The parsed input.
   */
  public function getParsedInput();

  /**
   * Parses the input data provided via URL params.
   *
   * @param array $input
   *   The input to set.
   */
  public function setParsedInput(array $input);

  /**
   * Gets the request path.
   *
   * @param bool $strip
   *   If TRUE it will strip the restful API prefix from the beginning.
   *
   * @return string
   *   The path.
   */
  public function getPath($strip = TRUE);

  /**
   * Gets the fully qualified URL with the query params.
   *
   * @return string
   *   The URL.
   */
  public function href();

  /**
   * Gets the headers bag.
   *
   * @return HttpHeaderBag
   */
  public function getHeaders();

  /**
   * Returns the user.
   *
   * @return
   *   string|null
   */
  public function getUser();

  /**
   * Returns the password.
   *
   * @return
   *   string|null
   */
  public function getPassword();

  /**
   * Get the HTTP method.
   *
   * @return string
   */
  public function getMethod();

  /**
   * Set the HTTP method.
   *
   * @param string $method
   *   The method to set.
   */
  public function setMethod($method);

  /**
   * Get the server information.
   *
   * @return array
   */
  public function getServer();

  /**
   * Sets an object in the application data store.
   *
   * @param string $key
   *   Identifier.
   * @param mixed $value
   *   The data to store as part of the request.
   */
  public function setApplicationData($key, $value);

  /**
   * Resets the application data.
   */
  public function clearApplicationData();

  /**
   * Gets an object from the application data store.
   *
   * @param string $key
   *   Identifier.
   *
   * @return mixed
   *   The data stored as part of the request.
   */
  public function getApplicationData($key);

  /**
   * Checks whether the request is secure or not.
   *
   * This method can read the client port from the "X-Forwarded-Proto" header
   * when trusted proxies were set via "setTrustedProxies()".
   *
   * The "X-Forwarded-Proto" header must contain the protocol: "https" or
   * "http".
   *
   * If your reverse proxy uses a different header name than "X-Forwarded-Proto"
   * ("SSL_HTTPS" for instance), configure it via "setTrustedHeaderName()" with
   * the "client-proto" key.
   *
   * @return bool
   */
  public function isSecure();

  /**
   * Get the files in the request.
   *
   * @return array
   *   The available files in the request.
   */
  public function getFiles();

  /**
   * Get CSRF Token.
   *
   * @return string
   *   Gets the CSRF token.
   */
  public function getCsrfToken();

  /**
   * Is via router.
   *
   * @return bool
   *   TRUE if the request was generated via the Drupal's menu router.
   */
  public function isViaRouter();

  /**
   * Marks the request as being via Drupal's menu router.
   *
   * @param bool $via_router
   *   The flag to set.
   */
  public function setViaRouter($via_router);

  /**
   * @return array
   */
  public function getCookies();

  /**
   * Get the normalized pager input.
   *
   * This is to support page=1&range=6 and page[number]=1&page[size]=6 at the
   * same time.
   *
   * @return array
   *   An associative array with the pager information in the form of
   *   page[number]=1&page[size]=6.
   */
  public function getPagerInput();

}

Members

Namesort descending Modifiers Type Description Overrides
RequestInterface::clearApplicationData public function Resets the application data. 1
RequestInterface::create public static function Creates a Request based on a given URI and configuration. 1
RequestInterface::createFromGlobals public static function Creates a new request with values from PHP's super globals. 1
RequestInterface::getApplicationData public function Gets an object from the application data store. 1
RequestInterface::getCookies public function 1
RequestInterface::getCsrfToken public function Get CSRF Token. 1
RequestInterface::getFiles public function Get the files in the request. 1
RequestInterface::getHeaders public function Gets the headers bag. 1
RequestInterface::getMethod public function Get the HTTP method. 1
RequestInterface::getPagerInput public function Get the normalized pager input. 1
RequestInterface::getParsedBody public function Parses the body string. 1
RequestInterface::getParsedInput public function Parses the input data provided via URL params. 1
RequestInterface::getPassword public function Returns the password. 1
RequestInterface::getPath public function Gets the request path. 1
RequestInterface::getServer public function Get the server information. 1
RequestInterface::getUser public function Returns the user. 1
RequestInterface::HEADER_CLIENT_HOST constant
RequestInterface::HEADER_CLIENT_IP constant
RequestInterface::HEADER_CLIENT_PORT constant
RequestInterface::HEADER_CLIENT_PROTO constant
RequestInterface::href public function Gets the fully qualified URL with the query params. 1
RequestInterface::isListRequest public function Helper method to know if the current request is for a list. 1
RequestInterface::isReadMethod public static function Determines if the HTTP method represents a read operation. 1
RequestInterface::isSecure public function Checks whether the request is secure or not. 1
RequestInterface::isValidMethod public static function Determines if the HTTP method is one of the known methods. 1
RequestInterface::isViaRouter public function Is via router. 1
RequestInterface::isWriteMethod public static function Determines if the HTTP method represents a write operation. 1
RequestInterface::METHOD_CONNECT constant
RequestInterface::METHOD_DELETE constant
RequestInterface::METHOD_GET constant
RequestInterface::METHOD_HEAD constant
RequestInterface::METHOD_OPTIONS constant
RequestInterface::METHOD_PATCH constant
RequestInterface::METHOD_POST constant
RequestInterface::METHOD_PURGE constant
RequestInterface::METHOD_PUT constant
RequestInterface::METHOD_TRACE constant
RequestInterface::setApplicationData public function Sets an object in the application data store. 1
RequestInterface::setMethod public function Set the HTTP method. 1
RequestInterface::setParsedInput public function Parses the input data provided via URL params. 1
RequestInterface::setViaRouter public function Marks the request as being via Drupal's menu router. 1