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

Breadcrumb

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

function PhpDumper::addRemovedIds

1 call to PhpDumper::addRemovedIds()
PhpDumper::startClass in vendor/symfony/dependency-injection/Dumper/PhpDumper.php

File

vendor/symfony/dependency-injection/Dumper/PhpDumper.php, line 1380

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function addRemovedIds() : string {
    $ids = $this->container
        ->getRemovedIds();
    foreach ($this->container
        ->getDefinitions() as $id => $definition) {
        if (!$definition->isPublic() && '.' !== ($id[0] ?? '-')) {
            $ids[$id] = true;
        }
    }
    if (!$ids) {
        return '';
    }
    if ($this->asFiles) {
        $code = "require \$this->containerDir.\\DIRECTORY_SEPARATOR.'removed-ids.php'";
    }
    else {
        $code = '';
        $ids = array_keys($ids);
        sort($ids);
        foreach ($ids as $id) {
            if (preg_match(FileLoader::ANONYMOUS_ID_REGEXP, $id)) {
                continue;
            }
            $code .= '            ' . $this->doExport($id) . " => true,\n";
        }
        $code = "[\n{$code}        ]";
    }
    return <<<EOF

    public function getRemovedIds(): array
    {
        return {<span class="php-variable">$code</span>};
    }

EOF;
}
RSS feed
Powered by Drupal