Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
console_migrator_output_handler | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
write | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
20 |
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 | |
14 | namespace phpbb\console\command\db; |
15 | |
16 | use phpbb\db\output_handler\migrator_output_handler_interface; |
17 | use phpbb\user; |
18 | use Symfony\Component\Console\Output\OutputInterface; |
19 | |
20 | class console_migrator_output_handler implements migrator_output_handler_interface |
21 | { |
22 | /** |
23 | * User object. |
24 | * |
25 | * @var user |
26 | */ |
27 | private $user; |
28 | |
29 | /** |
30 | * Console output object. |
31 | * |
32 | * @var OutputInterface |
33 | */ |
34 | private $output; |
35 | |
36 | /** |
37 | * Constructor |
38 | * |
39 | * @param user $user User object |
40 | * @param OutputInterface $output Console output object |
41 | */ |
42 | public function __construct(user $user, OutputInterface $output) |
43 | { |
44 | $this->user = $user; |
45 | $this->output = $output; |
46 | } |
47 | |
48 | /** |
49 | * {@inheritdoc} |
50 | */ |
51 | public function write($message, $verbosity) |
52 | { |
53 | if ($verbosity <= $this->output->getVerbosity()) |
54 | { |
55 | $translated_message = call_user_func_array(array($this->user, 'lang'), $message); |
56 | |
57 | if ($verbosity === migrator_output_handler_interface::VERBOSITY_NORMAL) |
58 | { |
59 | $translated_message = '<info>' . $translated_message . '</info>'; |
60 | } |
61 | else if ($verbosity === migrator_output_handler_interface::VERBOSITY_VERBOSE) |
62 | { |
63 | $translated_message = '<comment>' . $translated_message . '</comment>'; |
64 | } |
65 | |
66 | $this->output->writeln($translated_message); |
67 | } |
68 | } |
69 | } |