5 * Contains \Drupal\Console\Command\Breakpoints\DebugCommand.
8 namespace Drupal\Console\Command\Breakpoints;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Symfony\Component\Console\Command\Command;
14 use Drupal\breakpoint\BreakpointManagerInterface;
15 use Symfony\Component\Yaml\Yaml;
16 use Drupal\Console\Core\Command\Shared\CommandTrait;
17 use Drupal\Console\Annotations\DrupalCommand;
18 use Drupal\Console\Core\Style\DrupalStyle;
22 * extension = "breakpoint",
23 * extensionType = "module"
26 class DebugCommand extends Command
31 * @var BreakpointManagerInterface
33 protected $breakpointManager;
41 * DebugCommand constructor.
43 * @param BreakpointManagerInterface $breakpointManager
44 * @param string $appRoot
46 public function __construct(
47 BreakpointManagerInterface $breakpointManager,
50 $this->breakpointManager = $breakpointManager;
51 $this->appRoot = $appRoot;
52 parent::__construct();
58 protected function configure()
61 ->setName('breakpoints:debug')
62 ->setDescription($this->trans('commands.breakpoints.debug.description'))
65 InputArgument::OPTIONAL,
66 $this->trans('commands.breakpoints.debug.options.group-name')
73 protected function execute(InputInterface $input, OutputInterface $output)
75 $io = new DrupalStyle($input, $output);
77 $group = $input->getArgument('group');
79 $breakPointData = $this->getBreakpointByName($group);
80 foreach ($breakPointData as $key => $breakPoint) {
81 $io->comment($key, false);
82 $io->block(Yaml::dump($breakPoint));
87 $groups = array_keys($this->breakpointManager->getGroups());
90 $this->trans('commands.breakpoints.debug.messages.name'),
93 $io->table($tableHeader, $groups, 'compact');
99 * @param $group String
102 private function getBreakpointByName($group)
104 $typeExtension = implode(
106 array_values($this->breakpointManager->getGroupProviders($group))
109 if ($typeExtension == 'theme') {
110 $projectPath = drupal_get_path('theme', $group);
112 if ($typeExtension == 'module') {
113 $projectPath = drupal_get_path('module', $group);
116 $extensionFile = sprintf(
117 '%s/%s/%s.breakpoints.yml',
124 file_get_contents($extensionFile)