Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
list_all
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 configure
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14namespace phpbb\console\command\reparser;
15
16use Symfony\Component\Console\Command\Command as symfony_command;
17use Symfony\Component\Console\Input\InputInterface;
18use Symfony\Component\Console\Output\OutputInterface;
19use Symfony\Component\Console\Style\SymfonyStyle;
20
21class list_all extends \phpbb\console\command\command
22{
23    /**
24    * @var string[] Names of the reparser services
25    */
26    protected $reparser_names;
27
28    /**
29    * Constructor
30    *
31    * @param \phpbb\user $user
32    * @param \phpbb\di\service_collection $reparsers
33    */
34    public function __construct(\phpbb\user $user, \phpbb\di\service_collection $reparsers)
35    {
36        parent::__construct($user);
37        $this->reparser_names = array();
38        foreach ($reparsers as $reparser)
39        {
40            // Store the names without the "text_reparser." prefix
41            $this->reparser_names[] = $reparser->get_name();
42        }
43    }
44
45    /**
46    * Sets the command name and description
47    *
48    * @return void
49    */
50    protected function configure()
51    {
52        $this->setName('reparser:list')
53            ->setDescription($this->user->lang('CLI_DESCRIPTION_REPARSER_LIST'));
54    }
55
56    /**
57    * Executes the command reparser:list
58    *
59    * @param InputInterface $input
60    * @param OutputInterface $output
61    * @return int
62    */
63    protected function execute(InputInterface $input, OutputInterface $output)
64    {
65        $io = new SymfonyStyle($input, $output);
66        $io->section($this->user->lang('CLI_DESCRIPTION_REPARSER_AVAILABLE'));
67        $io->listing($this->reparser_names);
68
69        return symfony_command::SUCCESS;
70    }
71}