You are here

public function Request::get in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::get()

Gets a "parameter" value.

This method is mainly useful for libraries that want to provide some flexibility.

Order of precedence: GET, PATH, POST

Avoid using this method in controllers:

  • slow
  • prefer to get from a "named" source

It is better to explicitly get request parameters from the appropriate public property instead (query, attributes, request).

Parameters

string $key the key:

mixed $default the default value:

bool $deep is parameter deep in multidimensional array:

Return value

mixed

2 calls to Request::get()
Request::duplicate in vendor/symfony/http-foundation/Request.php
Clones a request and overrides some of its parameters.
Request::getRequestFormat in vendor/symfony/http-foundation/Request.php
Gets the request format.

File

vendor/symfony/http-foundation/Request.php, line 723

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function get($key, $default = null, $deep = false) {
  if ($this !== ($result = $this->query
    ->get($key, $this, $deep))) {
    return $result;
  }
  if ($this !== ($result = $this->attributes
    ->get($key, $this, $deep))) {
    return $result;
  }
  if ($this !== ($result = $this->request
    ->get($key, $this, $deep))) {
    return $result;
  }
  return $default;
}