5 * Contains \Drupal\Console\Command\Debug\BreakpointsCommand.
8 namespace Drupal\Console\Command\Debug;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Drupal\Console\Core\Command\Command;
14 use Drupal\breakpoint\BreakpointManagerInterface;
15 use Symfony\Component\Yaml\Yaml;
16 use Drupal\Console\Annotations\DrupalCommand;
20 * extension = "breakpoint",
21 * extensionType = "module"
24 class BreakpointsCommand extends Command
27 * @var BreakpointManagerInterface
29 protected $breakpointManager;
37 * BreakpointsCommand constructor.
39 * @param BreakpointManagerInterface $breakpointManager
40 * @param string $appRoot
42 public function __construct(
43 BreakpointManagerInterface $breakpointManager = null,
46 $this->breakpointManager = $breakpointManager;
47 $this->appRoot = $appRoot;
48 parent::__construct();
54 protected function configure()
57 ->setName('debug:breakpoints')
58 ->setDescription($this->trans('commands.debug.breakpoints.description'))
61 InputArgument::OPTIONAL,
62 $this->trans('commands.debug.breakpoints.options.group-name')
63 )->setAliases(['dbre']);
69 protected function execute(InputInterface $input, OutputInterface $output)
71 $group = $input->getArgument('group');
73 $breakPointData = $this->getBreakpointByName($group);
74 foreach ($breakPointData as $key => $breakPoint) {
75 $this->getIo()->comment($key, false);
76 $this->getIo()->block(Yaml::dump($breakPoint));
81 $groups = array_keys($this->breakpointManager->getGroups());
84 $this->trans('commands.debug.breakpoints.messages.name'),
87 $this->getIo()->table($tableHeader, $groups, 'compact');
93 * @param $group String
96 private function getBreakpointByName($group)
98 $typeExtension = implode(
100 array_values($this->breakpointManager->getGroupProviders($group))
103 $projectPath = drupal_get_path($typeExtension, $group);
105 $extensionFile = sprintf(
106 '%s/%s/%s.breakpoints.yml',
113 file_get_contents($extensionFile)