Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ParameterBag.php

function ParameterBag::getString

Returns the parameter as string.

3 calls to ParameterBag::getString()
ParameterBag::getAlnum in vendor/symfony/http-foundation/ParameterBag.php
Returns the alphabetic characters and digits of the parameter value.
ParameterBag::getAlpha in vendor/symfony/http-foundation/ParameterBag.php
Returns the alphabetic characters of the parameter value.
ParameterBag::getDigits in vendor/symfony/http-foundation/ParameterBag.php
Returns the digits of the parameter value.
1 method overrides ParameterBag::getString()
InputBag::getString in vendor/symfony/http-foundation/InputBag.php
Returns the parameter value converted to string.

File

vendor/symfony/http-foundation/ParameterBag.php, line 126

Class

ParameterBag
ParameterBag is a container for key/value pairs.

Namespace

Symfony\Component\HttpFoundation

Code

public function getString(string $key, string $default = '') : string {
    $value = $this->get($key, $default);
    if (!\is_scalar($value) && !$value instanceof \Stringable) {
        throw new UnexpectedValueException(\sprintf('Parameter value "%s" cannot be converted to "string".', $key));
    }
    return (string) $value;
}
RSS feed
Powered by Drupal