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

Breadcrumb

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

function Kernel::getContainerClass

Gets the container class.

Throws

\InvalidArgumentException If the generated classname is invalid

2 calls to Kernel::getContainerClass()
Kernel::getKernelParameters in vendor/symfony/http-kernel/Kernel.php
Returns the kernel parameters.
Kernel::initializeContainer in vendor/symfony/http-kernel/Kernel.php
Initializes the service container.

File

vendor/symfony/http-kernel/Kernel.php, line 362

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

protected function getContainerClass() : string {
    $class = static::class;
    $class = str_contains($class, "@anonymous\x00") ? get_parent_class($class) . str_replace('.', '_', ContainerBuilder::hash($class)) : $class;
    $class = str_replace('\\', '_', $class) . ucfirst($this->environment) . ($this->debug ? 'Debug' : '') . 'Container';
    if (!preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/', $class)) {
        throw new \InvalidArgumentException(\sprintf('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names.', $this->environment));
    }
    return $class;
}
RSS feed
Powered by Drupal