/**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var ExposedRoutesExtractorInterface $extractor */
     $extractor = $this->getContainer()->get('fos_js_routing.extractor');
     if ($input->getArgument('name')) {
         $route = $this->getContainer()->get('router')->getRouteCollection()->get($input->getArgument('name'));
         if (!$route) {
             throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $input->getArgument('name')));
         }
         $exposedRoutes = $extractor->getExposedRoutes();
         if (!isset($exposedRoutes[$input->getArgument('name')])) {
             throw new \InvalidArgumentException(sprintf('The route "%s" was found, but it is not an exposed route.', $input->getArgument('name')));
         }
         if (!class_exists('Symfony\\Bundle\\FrameworkBundle\\Console\\Helper\\DescriptorHelper')) {
             // BC layer for Symfony 2.3 and lower
             $this->outputRoute($output, $input->getArgument('name'));
         } else {
             $helper = new DescriptorHelper();
             $helper->describe($output, $route, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers')));
         }
     } else {
         if (!class_exists('Symfony\\Bundle\\FrameworkBundle\\Console\\Helper\\DescriptorHelper')) {
             // BC layer for Symfony 2.3 and lower
             $this->outputRoutes($output, $extractor->getExposedRoutes());
         } else {
             $routeCollection = new RouteCollection();
             foreach ($extractor->getExposedRoutes() as $name => $route) {
                 $routeCollection->add($name, $route);
             }
             $helper = new DescriptorHelper();
             $helper->describe($output, $routeCollection, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers')));
         }
     }
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var ExposedRoutesExtractorInterface $extractor */
     $extractor = $this->getContainer()->get('fos_js_routing.extractor');
     $exposeSets = $input->getOption('sets');
     if ($name = $input->getArgument('name')) {
         /** @var Route $route */
         $route = $this->getContainer()->get('router')->getRouteCollection()->get($name);
         if (!$route) {
             throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
         }
         if (!$extractor->isRouteExposed($route, $name, $exposeSets)) {
             throw new \InvalidArgumentException(sprintf('The route "%s" was found, but it is not an exposed route, or it is not in one of the sets : %s', $name, join(', ', $exposeSets)));
         }
         if (!class_exists('Symfony\\Bundle\\FrameworkBundle\\Console\\Helper\\DescriptorHelper')) {
             // BC layer for Symfony 2.3
             $this->outputRoute($output, $name);
         } else {
             $helper = new DescriptorHelper();
             $helper->describe($output, $route, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers')));
         }
     } else {
         if (!class_exists('Symfony\\Bundle\\FrameworkBundle\\Console\\Helper\\DescriptorHelper')) {
             // BC layer for Symfony 2.3
             $this->outputRoutes($output, $extractor->getRoutes($exposeSets));
         } else {
             $helper = new DescriptorHelper();
             $helper->describe($output, $extractor->getRoutes($exposeSets), array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers')));
         }
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException When route does not exist
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $name = $input->getArgument('name');
     $helper = new DescriptorHelper();
     if ($name) {
         $route = $this->getContainer()->get('router')->getRouteCollection()->get($name);
         if (!$route) {
             throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
         }
         $this->convertController($route);
         $helper->describe($output, $route, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'name' => $name));
     } else {
         $routes = $this->getContainer()->get('router')->getRouteCollection();
         foreach ($routes as $route) {
             $this->convertController($route);
         }
         $helper->describe($output, $routes, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers')));
     }
 }
 /**
  * {@inheritdoc}
  *
  * @throws \LogicException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($event = $input->getArgument('event')) {
         $options = array('event' => $event);
     } else {
         $options = array();
     }
     $dispatcher = $this->getEventDispatcher();
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $helper->describe($output, $dispatcher, $options);
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException When route does not exist
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (false !== strpos($input->getFirstArgument(), ':d')) {
         $output->writeln('<comment>The use of "router:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:router" instead.</comment>');
     }
     $name = $input->getArgument('name');
     $helper = new DescriptorHelper();
     if ($name) {
         $route = $this->getContainer()->get('router')->getRouteCollection()->get($name);
         if (!$route) {
             throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
         }
         $this->convertController($route);
         $helper->describe($output, $route, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'name' => $name));
     } else {
         $routes = $this->getContainer()->get('router')->getRouteCollection();
         foreach ($routes as $route) {
             $this->convertController($route);
         }
         $helper->describe($output, $routes, array('format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw'), 'show_controllers' => $input->getOption('show-controllers')));
     }
 }
 /**
  * {@inheritdoc}
  *
  * @throws \LogicException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $dispatcher = $this->getEventDispatcher();
     $options = array();
     if ($event = $input->getArgument('event')) {
         if (!$dispatcher->hasListeners($event)) {
             $io->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
             return;
         }
         $options = array('event' => $event);
     }
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $options['output'] = $io;
     $helper->describe($io, $dispatcher, $options);
 }
 /**
  * {@inheritdoc}
  *
  * @throws \LogicException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dispatcher = $this->getEventDispatcher();
     if ($event = $input->getArgument('event')) {
         if (!$dispatcher->hasListeners($event)) {
             $formatter = $this->getHelperSet()->get('formatter');
             $formattedBlock = $formatter->formatBlock(sprintf('[NOTE] The event "%s" does not have any registered listeners.', $event), 'fg=yellow', true);
             $output->writeln($formattedBlock);
             return;
         }
         $options = array('event' => $event);
     } else {
         $options = array();
     }
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $helper->describe($output, $dispatcher, $options);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (false !== strpos($input->getFirstArgument(), ':d')) {
         $output->writeln('<comment>The use of "container:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:container" instead.</comment>');
     }
     $this->validateInput($input);
     if ($input->getOption('parameters')) {
         $object = $this->getContainerBuilder()->getParameterBag();
         $options = array();
     } elseif ($parameter = $input->getOption('parameter')) {
         $object = $this->getContainerBuilder();
         $options = array('parameter' => $parameter);
     } elseif ($input->getOption('tags')) {
         $object = $this->getContainerBuilder();
         $options = array('group_by' => 'tags', 'show_private' => $input->getOption('show-private'));
     } elseif ($tag = $input->getOption('tag')) {
         $object = $this->getContainerBuilder();
         $options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
     } elseif ($name = $input->getArgument('name')) {
         $object = $this->getContainerBuilder();
         $name = $this->findProperServiceName($input, $output, $object, $name);
         $options = array('id' => $name);
     } else {
         $object = $this->getContainerBuilder();
         $options = array('show_private' => $input->getOption('show-private'));
     }
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $helper->describe($output, $object, $options);
     if (!$input->getArgument('name') && $input->isInteractive()) {
         $output->writeln('To search for a service, re-run this command with a search term. <comment>debug:container log</comment>');
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->validateInput($input);
     if ($input->getOption('parameters')) {
         $object = $this->getContainerBuilder()->getParameterBag();
         $options = array();
     } elseif ($parameter = $input->getOption('parameter')) {
         $object = $this->getContainerBuilder();
         $options = array('parameter' => $parameter);
     } elseif ($input->getOption('tags')) {
         $object = $this->getContainerBuilder();
         $options = array('group_by' => 'tags', 'show_private' => $input->getOption('show-private'));
     } elseif ($tag = $input->getOption('tag')) {
         $object = $this->getContainerBuilder();
         $options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
     } elseif ($name = $input->getArgument('name')) {
         $object = $this->getContainerBuilder();
         $name = $this->findProperServiceName($input, $output, $object, $name);
         $options = array('id' => $name);
     } else {
         $object = $this->getContainerBuilder();
         $options = array('show_private' => $input->getOption('show-private'));
     }
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $helper->describe($output, $object, $options);
     if (!$input->getArgument('name') && $input->isInteractive()) {
         $output->writeln('To search for a service, re-run this command with a search term. <comment>debug:container log</comment>');
     }
 }
Exemplo n.º 10
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->validateInput($input);
     if ($input->getOption('parameters')) {
         $object = $this->getContainerBuilder()->getParameterBag();
         $options = array();
     } elseif ($parameter = $input->getOption('parameter')) {
         $object = $this->getContainerBuilder();
         $options = array('parameter' => $parameter);
     } elseif ($input->getOption('tags')) {
         $object = $this->getContainerBuilder();
         $options = array('group_by' => 'tags', 'show_private' => $input->getOption('show-private'));
     } elseif ($tag = $input->getOption('tag')) {
         $object = $this->getContainerBuilder();
         $options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
     } elseif ($name = $input->getArgument('name')) {
         $object = $this->getContainerBuilder();
         $options = array('id' => $name);
     } else {
         $object = $this->getContainerBuilder();
         $options = array('show_private' => $input->getOption('show-private'));
     }
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $helper->describe($output, $object, $options);
 }
Exemplo n.º 11
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $this->validateInput($input);
     $object = $this->getContainerBuilder();
     if ($input->getOption('parameters')) {
         $parameters = array();
         foreach ($object->getParameterBag()->all() as $k => $v) {
             $parameters[$k] = $object->resolveEnvPlaceholders($v);
         }
         $object = new ParameterBag($parameters);
         $options = array();
     } elseif ($parameter = $input->getOption('parameter')) {
         $options = array('parameter' => $parameter);
     } elseif ($input->getOption('tags')) {
         $options = array('group_by' => 'tags', 'show_private' => $input->getOption('show-private'));
     } elseif ($tag = $input->getOption('tag')) {
         $options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
     } elseif ($name = $input->getArgument('name')) {
         $name = $this->findProperServiceName($input, $io, $object, $name);
         $options = array('id' => $name);
     } else {
         $options = array('show_private' => $input->getOption('show-private'));
     }
     $helper = new DescriptorHelper();
     $options['format'] = $input->getOption('format');
     $options['raw_text'] = $input->getOption('raw');
     $options['output'] = $io;
     $helper->describe($output, $object, $options);
     if (!$input->getArgument('name') && !$input->getOption('tag') && !$input->getOption('parameter') && $input->isInteractive()) {
         if ($input->getOption('tags')) {
             $io->comment('To search for a specific tag, re-run this command with a search term. (e.g. <comment>debug:container --tag=form.type</comment>)');
         } elseif ($input->getOption('parameters')) {
             $io->comment('To search for a specific parameter, re-run this command with a search term. (e.g. <comment>debug:container --parameter=kernel.debug</comment>)');
         } else {
             $io->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
         }
     }
 }