*/ class CacheCollectorPass implements CompilerPassInterface { private $dataCollectorCacheId; private $cachePoolTag; private $cachePoolRecorderInnerSuffix; public function __construct( string $dataCollectorCacheId = 'data_collector.cache', string $cachePoolTag = 'cache.pool', string $cachePoolRecorderInnerSuffix = '.recorder_inner', ) { if (0 < \func_num_args()) { trigger_deprecation('symfony/cache', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); } $this->dataCollectorCacheId = $dataCollectorCacheId; $this->cachePoolTag = $cachePoolTag; $this->cachePoolRecorderInnerSuffix = $cachePoolRecorderInnerSuffix; } /** * {@inheritdoc} */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition($this->dataCollectorCacheId)) { return; } foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $attributes) { $poolName = $attributes[0]['name'] ?? $id; $this->addToCollector($id, $poolName, $container); } } private function addToCollector(string $id, string $name, ContainerBuilder $container) { $definition = $container->getDefinition($id); if ($definition->isAbstract()) { return; } $collectorDefinition = $container->getDefinition($this->dataCollectorCacheId); $recorder = new Definition(is_subclass_of($definition->getClass(), TagAwareAdapterInterface::class) ? TraceableTagAwareAdapter::class : TraceableAdapter::class); $recorder->setTags($definition->getTags()); if (!$definition->isPublic() || !$definition->isPrivate()) { $recorder->setPublic($definition->isPublic()); } $recorder->setArguments([new Reference($innerId = $id.$this->cachePoolRecorderInnerSuffix)]); foreach ($definition->getMethodCalls() as [$method, $args]) { if ('setCallbackWrapper' !== $method || !$args[0] instanceof Definition || !($args[0]->getArguments()[2] ?? null) instanceof Definition) { continue; } if ([new Reference($id), 'setCallbackWrapper'] == $args[0]->getArguments()[2]->getFactory()) { $args[0]->getArguments()[2]->setFactory([new Reference($innerId), 'setCallbackWrapper']); } } $definition->setTags([]); $definition->setPublic(false); $container->setDefinition($innerId, $definition); $container->setDefinition($id, $recorder); // Tell the collector to add the new instance $collectorDefinition->addMethodCall('addInstance', [$name, new Reference($id)]); $collectorDefinition->setPublic(false); } } __halt_compiler();----SIGNATURE:----l5wu+pnqDp3o71mMe3OWqTxk04z9fX16wddPy+PDzDQsU47q+pRLx0In8Op60IEdkazOtz7jl6Mv2fqDMg2igcWHnxxUiHzYAgX6dCA8hsKdpCcqR415s6T/OyPg7e4TGNKZu90y/fKZF7iJBhogPRPcbCfQtPggkUjelspCrLv3se//ep2oNtTRvCvarB14Oxfz9g3RN+xoFk99/NbSQaXfYuCLyxbF8z0TjS5Q4czUIPqrBWX2jFWvQANIQF8p8upFIMn37akdjLMtmJGqZHFszK441wntgfU65nrv/odt7QS5Xwx6U/GONTSjzqEt+e4bCnkX6U0VtUqT74FJ2lN6kQozFI5ul2AVgzyQBDYsMGvLI+wRsI9OxEzho1W78DNBSRVZGRPOsdAHYCNtgVpO12C+Jx8qdj3butA9AM7qhciFoWwrmWjU/U0EviL0cDCNrlxKNkBbgt7oUEzmQpyw8rodvJCoSnhzb0p9Abvbc5XEMyz+a5X3DpPlvDeZrUYD+pkJsq2PkwyOmvRCwaLoXsQcg8mmMpIHfnnAXqFqQLNXUSWdiEnCQ3Vc00m8ES5aoi4S5JTEXSW2WRln+i3i7dL9SpxZgDx+GDoox/4v2IOqFcSNkFOnB+LGmNFp8mIgvPzzRacficFgw3YqfeHO12YbxpWdcd9PEA4Wx/E=----ATTACHMENT:----NzMzMjQ1NjM0NjIyNjkwMSAzNzIxNTE5NjE4NjAxNDI3IDYzOTUzOTM2MTA4ODM5Njk=