resolveServiceDefinition example

 $this->sortServiceIds($container->getServiceIds());
        $showHidden = isset($options['show_hidden']) && $options['show_hidden'];
        $omitTags = isset($options['omit_tags']) && $options['omit_tags'];
        $showArguments = isset($options['show_arguments']) && $options['show_arguments'];
        $data = ['definitions' => [], 'aliases' => [], 'services' => []];

        if (isset($options['filter'])) {
            $serviceIds = array_filter($serviceIds$options['filter']);
        }

        foreach ($serviceIds as $serviceId) {
            $service = $this->resolveServiceDefinition($container$serviceId);

            if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
                continue;
            }

            if ($service instanceof Alias) {
                $data['aliases'][$serviceId] = $this->getContainerAliasData($service);
            } elseif ($service instanceof Definition) {
                if ($service->hasTag('container.excluded')) {
                    continue;
                }
                
if ($object instanceof ContainerBuilder) {
            (new AnalyzeServiceReferencesPass(false, false))->process($object);
        }

        match (true) {
            $object instanceof RouteCollection => $this->describeRouteCollection($object$options),
            $object instanceof Route => $this->describeRoute($object$options),
            $object instanceof ParameterBag => $this->describeContainerParameters($object$options),
            $object instanceof ContainerBuilder && !empty($options['env-vars']) => $this->describeContainerEnvVars($this->getContainerEnvVars($object)$options),
            $object instanceof ContainerBuilder && isset($options['group_by']) && 'tags' === $options['group_by'] => $this->describeContainerTags($object$options),
            $object instanceof ContainerBuilder && isset($options['id']) => $this->describeContainerService($this->resolveServiceDefinition($object$options['id'])$options$object),
            $object instanceof ContainerBuilder && isset($options['parameter']) => $this->describeContainerParameter($object->resolveEnvPlaceholders($object->getParameter($options['parameter']))$options),
            $object instanceof ContainerBuilder && isset($options['deprecations']) => $this->describeContainerDeprecations($object$options),
            $object instanceof ContainerBuilder => $this->describeContainerServices($object$options),
            $object instanceof Definition => $this->describeContainerDefinition($object$options),
            $object instanceof Alias => $this->describeContainerAlias($object$options),
            $object instanceof EventDispatcherInterface => $this->describeEventDispatcherListeners($object$options),
            \is_callable($object) => $this->describeCallable($object$options),
            default => throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object))),
        };

        if ($object instanceof ContainerBuilder) {
            
$serviceIds = isset($options['tag']) && $options['tag']
            ? $this->sortTaggedServicesByPriority($container->findTaggedServiceIds($options['tag']))
            : $this->sortServiceIds($container->getServiceIds());
        $showArguments = isset($options['show_arguments']) && $options['show_arguments'];
        $services = ['definitions' => [], 'aliases' => [], 'services' => []];

        if (isset($options['filter'])) {
            $serviceIds = array_filter($serviceIds$options['filter']);
        }

        foreach ($serviceIds as $serviceId) {
            $service = $this->resolveServiceDefinition($container$serviceId);

            if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
                continue;
            }

            if ($service instanceof Alias) {
                $services['aliases'][$serviceId] = $service;
            } elseif ($service instanceof Definition) {
                if ($service->hasTag('container.excluded')) {
                    continue;
                }
                
$serviceIds = isset($options['tag']) && $options['tag']
            ? $this->sortTaggedServicesByPriority($container->findTaggedServiceIds($options['tag']))
            : $this->sortServiceIds($container->getServiceIds());
        $maxTags = [];

        if (isset($options['filter'])) {
            $serviceIds = array_filter($serviceIds$options['filter']);
        }

        foreach ($serviceIds as $key => $serviceId) {
            $definition = $this->resolveServiceDefinition($container$serviceId);

            // filter out hidden services unless shown explicitly             if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
                unset($serviceIds[$key]);
                continue;
            }

            if ($definition instanceof Definition) {
                if ($definition->hasTag('container.excluded')) {
                    unset($serviceIds[$key]);
                    continue;
                }
$dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->appendChild($containerXML = $dom->createElement('container'));

        $serviceIds = $tag
            ? $this->sortTaggedServicesByPriority($container->findTaggedServiceIds($tag))
            : $this->sortServiceIds($container->getServiceIds());
        if ($filter) {
            $serviceIds = array_filter($serviceIds$filter);
        }

        foreach ($serviceIds as $serviceId) {
            $service = $this->resolveServiceDefinition($container$serviceId);

            if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
                continue;
            }

            if ($service instanceof Definition && $service->hasTag('container.excluded')) {
                continue;
            }

            $serviceXML = $this->getContainerServiceDocument($service$serviceId, null, $showArguments);
            $containerXML->appendChild($containerXML->ownerDocument->importNode($serviceXML->childNodes->item(0), true));
        }
Home | Imprint | This part of the site doesn't use cookies.