TwigExtensionPass.php in Drupal 10
File
core/lib/Drupal/Core/DependencyInjection/Compiler/TwigExtensionPass.php
View source
<?php
namespace Drupal\Core\DependencyInjection\Compiler;
use Drupal\Component\Utility\Crypt;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class TwigExtensionPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
$twig_extension_hash = '';
foreach (array_keys($container
->findTaggedServiceIds('twig.extension')) as $service_id) {
$class_name = $container
->getDefinition($service_id)
->getClass();
$reflection = new \ReflectionClass($class_name);
$twig_extension_hash .= $class_name . filemtime($reflection
->getFileName());
}
$container
->setParameter('twig_extension_hash', Crypt::hashBase64($twig_extension_hash));
}
}