示例#1
0
 /**
  * Constructor
  *
  * @param \phpbb\template\template $template Template object
  * @param \phpbb\user $user User object
  * @param \phpbb\config\config $config Config object
  * @param \phpbb\controller\provider $provider Path provider
  * @param \phpbb\extension\manager $manager Extension manager object
  * @param \phpbb\symfony_request $symfony_request Symfony Request object
  * @param \phpbb\request\request_interface $request phpBB request object
  * @param \phpbb\filesystem $filesystem The filesystem object
  * @param string $phpbb_root_path phpBB root path
  * @param string $php_ext PHP file extension
  */
 public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, \phpbb\request\request_interface $request, \phpbb\filesystem $filesystem, $phpbb_root_path, $php_ext)
 {
     $this->template = $template;
     $this->user = $user;
     $this->config = $config;
     $this->symfony_request = $symfony_request;
     $this->request = $request;
     $this->filesystem = $filesystem;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $php_ext;
     $provider->find_routing_files($manager->get_finder());
     $this->route_collection = $provider->find($phpbb_root_path)->get_routes();
 }
示例#2
0
 /**
  * @throws \InvalidArgumentException When route does not exist
  */
 protected function outputRoute(OutputInterface $output, $name)
 {
     $route = $this->controller_provider->get_routes()->get($name);
     if (!$route) {
         throw new \InvalidArgumentException($this->user->lang('NICOFUMA_DEBUGTOOLS_CLI_EXCEPTION_ROUTER_DEBUG_ROUTE_NOT_EXIST', $name));
     }
     $output->writeln($this->getHelper('formatter')->formatSection('router', $this->user->lang('ROUTE_NAME', $name)));
     $method = $route->getMethods() ? implode('|', $route->getMethods()) : $this->user->lang('ANY_MAJ');
     $scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : $this->user->lang('ANY_MAJ');
     $host = '' !== $route->getHost() ? $route->getHost() : $this->user->lang('ANY_MAJ');
     $output->write('<comment>' . $this->user->lang('NAME') . '</comment> ');
     $output->writeln($name, OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('PATH') . '</comment> ');
     $output->writeln($route->getPath(), OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('HOST') . '</comment> ');
     $output->writeln($host, OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('SCHEME') . '</comment> ');
     $output->writeln($scheme, OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('METHOD') . '</comment> ');
     $output->writeln($method, OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('CLASS') . '</comment> ');
     $output->writeln(get_class($route), OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('DEFAULTS') . '</comment> ');
     $output->writeln($this->formatConfigs($route->getDefaults()), OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('REQUIREMENTS') . '</comment> ');
     // we do not want to show the schemes and methods again that are also in the requirements for BC
     $requirements = $route->getRequirements();
     unset($requirements['_scheme'], $requirements['_method']);
     $output->writeln($this->formatConfigs($requirements) ?: $this->user->lang('NO_CUSTOM_MAJ'), OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('OPTIONS') . '</comment> ');
     $output->writeln($this->formatConfigs($route->getOptions()), OutputInterface::OUTPUT_RAW);
     $output->write('<comment>' . $this->user->lang('PATH_REGEX') . '</comment> ');
     $output->writeln($route->compile()->getRegex(), OutputInterface::OUTPUT_RAW);
     if (null !== $route->compile()->getHostRegex()) {
         $output->write('<comment>' . $this->user->lang('HOST_REGEX') . '</comment> ');
         $output->writeln($route->compile()->getHostRegex(), OutputInterface::OUTPUT_RAW);
     }
 }