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

Breadcrumb

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

function ConfigDataCollector::collect

Overrides DataCollectorInterface::collect

File

vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php, line 38

Class

ConfigDataCollector
@author Fabien Potencier <fabien@symfony.com>

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

public function collect(Request $request, Response $response, ?\Throwable $exception = null) : void {
    $eom = \DateTimeImmutable::createFromFormat('d/m/Y', '01/' . Kernel::END_OF_MAINTENANCE);
    $eol = \DateTimeImmutable::createFromFormat('d/m/Y', '01/' . Kernel::END_OF_LIFE);
    $xdebugMode = getenv('XDEBUG_MODE') ?: \ini_get('xdebug.mode');
    $this->data = [
        'token' => $response->headers
            ->get('X-Debug-Token'),
        'symfony_version' => Kernel::VERSION,
        'symfony_minor_version' => \sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
        'symfony_lts' => 4 === Kernel::MINOR_VERSION,
        'symfony_state' => $this->determineSymfonyState(),
        'symfony_eom' => $eom->format('F Y'),
        'symfony_eol' => $eol->format('F Y'),
        'env' => isset($this->kernel) ? $this->kernel
            ->getEnvironment() : 'n/a',
        'debug' => isset($this->kernel) ? $this->kernel
            ->isDebug() : 'n/a',
        'php_version' => \PHP_VERSION,
        'php_architecture' => \PHP_INT_SIZE * 8,
        'php_intl_locale' => class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
        'php_timezone' => date_default_timezone_get(),
        'xdebug_enabled' => \extension_loaded('xdebug'),
        'xdebug_status' => \extension_loaded('xdebug') ? $xdebugMode && $xdebugMode !== 'off' ? 'Enabled (' . $xdebugMode . ')' : 'Not enabled' : 'Not installed',
        'apcu_enabled' => \extension_loaded('apcu') && filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOL),
        'apcu_status' => \extension_loaded('apcu') ? filter_var(\ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled' : 'Not installed',
        'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL),
        'zend_opcache_status' => \extension_loaded('Zend OPcache') ? filter_var(\ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'Enabled' : 'Not enabled' : 'Not installed',
        'bundles' => [],
        'sapi_name' => \PHP_SAPI,
    ];
    if (isset($this->kernel)) {
        foreach ($this->kernel
            ->getBundles() as $name => $bundle) {
            $this->data['bundles'][$name] = new ClassStub($bundle::class);
        }
    }
    if (preg_match('~^(\\d+(?:\\.\\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
        $this->data['php_version'] = $matches[1];
        $this->data['php_version_extra'] = $matches[2];
    }
}
RSS feed
Powered by Drupal