describeCallable example

$registeredListeners = $eventDispatcher->getListeners($event);
        } else {
            // Try to see if "events" exists             $registeredListeners = \array_key_exists('events', $options) ? array_combine($options['events']array_map(fn ($event) => $eventDispatcher->getListeners($event)$options['events'])) : $eventDispatcher->getListeners();
        }

        $this->write(sprintf('# %s', $title)."\n");

        if (null !== $event) {
            foreach ($registeredListeners as $order => $listener) {
                $this->write("\n".sprintf('## Listener %d', $order + 1)."\n");
                $this->describeCallable($listener);
                $this->write(sprintf('- Priority: `%d`', $eventDispatcher->getListenerPriority($event$listener))."\n");
            }
        } else {
            ksort($registeredListeners);

            foreach ($registeredListeners as $eventListened => $eventListeners) {
                $this->write("\n".sprintf('## %s', $eventListened)."\n");

                foreach ($eventListeners as $order => $eventListener) {
                    $this->write("\n".sprintf('### Listener %d', $order + 1)."\n");
                    $this->describeCallable($eventListener);
                    
$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) {
            $object->getCompiler()->getServiceReferenceGraph()->clear();
        }
    }

    protected function getOutput(): OutputInterface
    {
        return $this->output;
    }
Home | Imprint | This part of the site doesn't use cookies.