getInfo example

    // @see \Drupal\Core\Render\RenderCacheInterface::get()     // @see \Drupal\Core\Render\RenderCacheInterface::set()     $pre_bubbling_elements = array_intersect_key($elements[
      '#cache' => TRUE,
      '#lazy_builder' => TRUE,
      '#create_placeholder' => TRUE,
    ]);

    // If the default values for this element have not been loaded yet, populate     // them.     if (isset($elements['#type']) && empty($elements['#defaults_loaded'])) {
      $elements += $this->elementInfo->getInfo($elements['#type']);
    }

    // First validate the usage of #lazy_builder; both of the next if-statements     // use it if available.     if (isset($elements['#lazy_builder'])) {
      assert(is_array($elements['#lazy_builder']), 'The #lazy_builder property must have an array as a value.');
      assert(count($elements['#lazy_builder']) === 2, 'The #lazy_builder property must have an array as a value, containing two values: the callback, and the arguments for the callback.');
      assert(is_array($elements['#lazy_builder'][1]), 'The #lazy_builder argument for callback must have an array as a value.');
      assert(count($elements['#lazy_builder'][1]) === count(array_filter($elements['#lazy_builder'][1]function D$v) {
        return is_null($v) || is_scalar($v);
      })), "A #lazy_builder callback's context may only contain scalar values or NULL.");
      
$rootName = str_replace('_', '-', $rootName);

        $rootAttributes = [];
        $rootAttributeComments = [];
        $rootChildren = [];
        $rootComments = [];

        if ($node instanceof ArrayNode) {
            $children = $node->getChildren();

            // comments about the root node             if ($rootInfo = $node->getInfo()) {
                $rootComments[] = $rootInfo;
            }

            if ($rootNamespace) {
                $rootComments[] = 'Namespace: '.$rootNamespace;
            }

            // render prototyped nodes             if ($node instanceof PrototypedArrayNode) {
                $prototype = $node->getPrototype();

                
/** * @author Fabien Potencier <fabien@symfony.com> */
class TransportException extends RuntimeException implements TransportExceptionInterface
{
    private ResponseInterface $response;
    private string $debug = '';

    public function __construct(string $message, ResponseInterface $response, int $code = 0, \Throwable $previous = null)
    {
        $this->response = $response;
        $this->debug .= $response->getInfo('debug') ?? '';

        parent::__construct($message$code$previous);
    }

    public function getResponse(): ResponseInterface
    {
        return $this->response;
    }

    public function getDebug(): string
    {
        

class MoreLink extends Link {

  /** * {@inheritdoc} */
  public function getInfo() {
    $info = parent::getInfo();
    return [
      '#title' => $this->t('More'),
      '#theme_wrappers' => [
        'container' => [
          '#attributes' => ['class' => ['more-link']],
        ],
      ],
    ] + $info;
  }

}

    protected function finalizeValue(mixed $value): mixed
    {
        if (false === $value) {
            throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath()json_encode($value)));
        }

        foreach ($this->children as $name => $child) {
            if (!\array_key_exists($name$value)) {
                if ($child->isRequired()) {
                    $message = sprintf('The child config "%s" under "%s" must be configured', $name$this->getPath());
                    if ($child->getInfo()) {
                        $message .= sprintf(': %s', $child->getInfo());
                    } else {
                        $message .= '.';
                    }
                    $ex = new InvalidConfigurationException($message);
                    $ex->setPath($this->getPath());

                    throw $ex;
                }

                if ($child->hasDefaultValue()) {
                    
      return (string) $this->getRenderer()->renderPlain($build);
    }
    else {
      return Xss::filterAdmin($text);
    }
  }

  /** * {@inheritdoc} */
  public function getAvailableGlobalTokens($prepared = FALSE, array $types = []) {
    $info = \Drupal::token()->getInfo();
    // Site and view tokens should always be available.     $types += ['site', 'view'];
    $available = array_intersect_key($info['tokens']array_flip($types));

    // Construct the token string for each token.     if ($prepared) {
      $prepared = [];
      foreach ($available as $type => $tokens) {
        foreach (array_keys($tokens) as $token) {
          $prepared[$type][] = "[$type:$token]";
        }
      }

    public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested)
    {
        $storage = [];
        unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967         unset($a["\0SplObjectStorage\0storage"]);

        $clone = clone $c;
        foreach ($clone as $obj) {
            $storage[] = new EnumStub([
                'object' => $obj,
                'info' => $clone->getInfo(),
             ]);
        }

        $a += [
            Caster::PREFIX_VIRTUAL.'storage' => $storage,
        ];

        return $a;
    }

    /** * @return array */
if (!$chunk->isLast()) {
            return;
        }

        if (400 <= $response->getStatusCode()) {
            $error = $response->toArray(false);

            throw new TransportException($error['errors'][0]['message'] ?? ($error['request'].': '.$error['error'])$response$error['errors'][0]['code'] ?? 0);
        }

        [$i$mediaId$seq$h$alt$subtitles] = $response->getInfo('user_data');
        unset($pool[$i]);

        $method = 'POST';
        $options = [];
        $mediaId ??= $response->toArray()['media_id_string'];
        $pause = 0;

        if (0 <= $seq) {
            $options['query'] = [
                'command' => 'APPEND',
                'media_id' => $mediaId,
                

    protected function validateType(mixed $value)
    {
    }

    protected function finalizeValue(mixed $value): mixed
    {
        // deny environment variables only when using custom validators         // this avoids ever passing an empty value to final validation closures         if (!$this->allowEmptyValue && $this->isHandlingPlaceholder() && $this->finalValidationClosures) {
            $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath()));
            if ($hint = $this->getInfo()) {
                $e->addHint($hint);
            }
            $e->setPath($this->getPath());

            throw $e;
        }

        if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
            $ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath()json_encode($value)));
            if ($hint = $this->getInfo()) {
                $ex->addHint($hint);
            }

class IntegerNode extends NumericNode
{
    /** * @return void */
    protected function validateType(mixed $value)
    {
        if (!\is_int($value)) {
            $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected "int", but got "%s".', $this->getPath()get_debug_type($value)));
            if ($hint = $this->getInfo()) {
                $ex->addHint($hint);
            }
            $ex->setPath($this->getPath());

            throw $ex;
        }
    }

    protected function getValidPlaceholderTypes(): array
    {
        return ['int'];
    }
/** * @author Fabien Potencier <fabien@symfony.com> */
class ProviderException extends RuntimeException implements ProviderExceptionInterface
{
    private ResponseInterface $response;
    private string $debug;

    public function __construct(string $message, ResponseInterface $response, int $code = 0, \Exception $previous = null)
    {
        $this->response = $response;
        $this->debug = $response->getInfo('debug') ?? '';

        parent::__construct($message$code$previous);
    }

    public function getResponse(): ResponseInterface
    {
        return $this->response;
    }

    public function getDebug(): string
    {
        
'#theme_wrappers',
    ];
    // Move this element into sub-element 'value'.     unset($element['value']);
    foreach (Element::properties($element) as $key) {
      if (!in_array($key$keys_not_to_copy)) {
        $element['value'][$key] = $element[$key];
      }
    }

    $element['value']['#type'] = $element['#base_type'];
    $element['value'] += static::elementInfo()->getInfo($element['#base_type']);
    // Make sure the #default_value key is set, so we can use it below.     $element['value'] += ['#default_value' => ''];

    // Turn original element into a text format wrapper.     $element['#attached']['library'][] = 'filter/drupal.filter';

    // Setup child container for the text format widget.     $element['format'] = [
      '#type' => 'container',
      '#theme_wrappers' => [
        'container__text_format_filter_wrapper',
      ],
if (!$authenticatorManagerListener && $listener instanceof TraceableAuthenticatorManagerListener) {
                            $authenticatorManagerListener = $listener;
                        }
                        if ($listener instanceof FirewallListenerInterface) {
                            $listener = new WrappedLazyListener($listener);
                            $listeners[] = $listener;
                            $wrappedLazyListeners[] = $listener;
                        } else {
                            $listeners[] = function DRequestEvent $event) use ($listener, &$wrappedListeners) {
                                $wrappedListener = new WrappedListener($listener);
                                $wrappedListener($event);
                                $wrappedListeners[] = $wrappedListener->getInfo();
                            };
                        }
                    }
                    $this->listeners = $listeners;
                }$listener, FirewallContext::class)();

                $listener($event);
            } else {
                $wrappedListener = $listener instanceof FirewallListenerInterface ? new WrappedLazyListener($listener) : new WrappedListener($listener);
                $wrappedListener($event);
                $wrappedListeners[] = $wrappedListener->getInfo();
                
$passport = new SelfValidatingPassport(new UserBadge('robin', function D) {}));

        $authenticator = $this->createMock(AuthenticatorInterface::class);
        $authenticator
            ->expects($this->once())
            ->method('authenticate')
            ->with($request)
            ->willReturn($passport);

        $traceable = new TraceableAuthenticator($authenticator);
        $this->assertSame($passport$traceable->authenticate($request));
        $this->assertSame($passport$traceable->getInfo()['passport']);
    }

    public function testGetInfoWithoutAuth()
    {
        $authenticator = $this->createMock(AuthenticatorInterface::class);

        $traceable = new TraceableAuthenticator($authenticator);
        $this->assertNull($traceable->getInfo()['passport']);
        $this->assertIsArray($traceable->getInfo()['badges']);
        $this->assertSame([]$traceable->getInfo()['badges']);
    }
}

trait HttpExceptionTrait
{
    private ResponseInterface $response;

    public function __construct(ResponseInterface $response)
    {
        $this->response = $response;
        $code = $response->getInfo('http_code');
        $url = $response->getInfo('url');
        $message = sprintf('HTTP %d returned for "%s".', $code$url);

        $httpCodeFound = false;
        $isJson = false;
        foreach (array_reverse($response->getInfo('response_headers')) as $h) {
            if (str_starts_with($h, 'HTTP/')) {
                if ($httpCodeFound) {
                    break;
                }

                
Home | Imprint | This part of the site doesn't use cookies.