X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FBreakpoints%2FDebugCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FBreakpoints%2FDebugCommand.php;h=fd23dd52d91a623c42add87df94dcbfd3f79799a;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drupal/console/src/Command/Breakpoints/DebugCommand.php b/vendor/drupal/console/src/Command/Breakpoints/DebugCommand.php new file mode 100644 index 000000000..fd23dd52d --- /dev/null +++ b/vendor/drupal/console/src/Command/Breakpoints/DebugCommand.php @@ -0,0 +1,127 @@ +breakpointManager = $breakpointManager; + $this->appRoot = $appRoot; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('breakpoints:debug') + ->setDescription($this->trans('commands.breakpoints.debug.description')) + ->addArgument( + 'group', + InputArgument::OPTIONAL, + $this->trans('commands.breakpoints.debug.options.group-name') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $group = $input->getArgument('group'); + if ($group) { + $breakPointData = $this->getBreakpointByName($group); + foreach ($breakPointData as $key => $breakPoint) { + $io->comment($key, false); + $io->block(Yaml::dump($breakPoint)); + } + + return 0; + } + $groups = array_keys($this->breakpointManager->getGroups()); + + $tableHeader = [ + $this->trans('commands.breakpoints.debug.messages.name'), + ]; + + $io->table($tableHeader, $groups, 'compact'); + + return 0; + } + + /** + * @param $group String + * @return mixed + */ + private function getBreakpointByName($group) + { + $typeExtension = implode( + ',', + array_values($this->breakpointManager->getGroupProviders($group)) + ); + + if ($typeExtension == 'theme') { + $projectPath = drupal_get_path('theme', $group); + } + if ($typeExtension == 'module') { + $projectPath = drupal_get_path('module', $group); + } + + $extensionFile = sprintf( + '%s/%s/%s.breakpoints.yml', + $this->appRoot, + $projectPath, + $group + ); + + return Yaml::parse( + file_get_contents($extensionFile) + ); + } +}