* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Checks your services for circular references. * * References from method calls are ignored since we might be able to resolve * these references depending on the order in which services are called. * * Circular reference from method calls will only be detected at run-time. * * @author Johannes M. Schmitt */ class CheckCircularReferencesPass implements CompilerPassInterface { private $currentPath; private $checkedNodes; /** * Checks the ContainerBuilder object for circular references. */ public function process(ContainerBuilder $container) { $graph = $container->getCompiler()->getServiceReferenceGraph(); $this->checkedNodes = array(); foreach ($graph->getNodes() as $id => $node) { $this->currentPath = array($id); $this->checkOutEdges($node->getOutEdges()); } } /** * Checks for circular references. * * @param ServiceReferenceGraphEdge[] $edges An array of Edges * * @throws ServiceCircularReferenceException when a circular reference is found */ private function checkOutEdges(array $edges) { foreach ($edges as $edge) { $node = $edge->getDestNode(); $id = $node->getId(); if (empty($this->checkedNodes[$id])) { // Don't check circular references for lazy edges if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) { $searchKey = array_search($id, $this->currentPath); $this->currentPath[] = $id; if (false !== $searchKey) { throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey)); } $this->checkOutEdges($node->getOutEdges()); } $this->checkedNodes[$id] = true; array_pop($this->currentPath); } } } } __halt_compiler();----SIGNATURE:----iau95+Odns0QnDVEX3QykP3xElG7nxPYkRUvqr8Sb0HpAFKOYDhxHc6tnd3sPn0d5ZAEIjir8k4No9zbrqpiUr5ageQTJMOttYTRP+CnT4SXh8uFVX6Lcs+j2izg2QcPeFKDah33DVFOVjgpONQAh2CvkPstXTBjeMFBcxQIXAUSUkIX/d8akI/W1LVyvaBrhwAjudm2kItzpp96v//noj0Lrax6opgf0ju6Lv/gml6WdxH5d3OxH/5EamlIyOfl3SnhPHtYDBDnwfU59ye/MfG9FvTIj/IKgc3EdVRkcxgxJdgn6FTdFL7JqtfLaF6YKFK76svVRthC4msDzxVPnprEfsHTHRQaM0rmC2oVrGeqwfs0ggYmPaDtH+6z8i3CcZtunUlC4EIyz3OhIpCsh8plXqpM3WmB9gnoh7FGr6MIcHVbgLkNRsft943HJf7peomsTIHHrw+SyTSVVNbrqtShs60yLRZyoADWniqSGTQI+eOX0dk1rjKElNOxw/0OrqFtuDtcjzPZEuaXoWof9Fkd44h0u/sWoUwB5QNN6JAXfzZSOaxyW4hUtJLRTzvWe+qWtFwz2AGmBr+On0xW+te7tNKg5miZdK3Rm+UH7B7WQNqREn/X+ehM1/r5zAGF+ot+FTgWPU09PMNP4PVfCwa3U8PQE+oFAR4+6TCcWiY=----ATTACHMENT:----NzExOTEwMTUxMDYyMjg2IDc2MTMzNjgwMjExMDA2NjcgNTEzNjk2Njc0MzQ3MTA1NQ==