1 | <?php |
||
8 | class Logger |
||
9 | { |
||
10 | /** |
||
11 | * The console output interface. |
||
12 | * |
||
13 | * @var \Symfony\Component\Console\Output\OutputInterface |
||
14 | */ |
||
15 | protected $consoleOutput; |
||
16 | |||
17 | /** |
||
18 | * Wether the logger is enabled. |
||
19 | * |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $enabled = false; |
||
23 | |||
24 | /** |
||
25 | * Wether the verbose mode is on. |
||
26 | * |
||
27 | * @var bool |
||
28 | */ |
||
29 | protected $verbose = false; |
||
30 | |||
31 | /** |
||
32 | * Check if the logger is active. |
||
33 | * |
||
34 | * @return bool |
||
35 | */ |
||
36 | public static function isEnabled(): bool |
||
42 | |||
43 | /** |
||
44 | * Create a new Logger instance. |
||
45 | * |
||
46 | * @param \Symfony\Component\Console\Output\OutputInterface $consoleOutput |
||
47 | * @return void |
||
|
|||
48 | */ |
||
49 | public function __construct(OutputInterface $consoleOutput) |
||
53 | |||
54 | /** |
||
55 | * Enable the logger. |
||
56 | * |
||
57 | * @param bool $enabled |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function enable($enabled = true) |
||
66 | |||
67 | /** |
||
68 | * Enable the verbose mode. |
||
69 | * |
||
70 | * @param bool $verbose |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function verbose($verbose = false) |
||
79 | |||
80 | /** |
||
81 | * Trigger an Info message. |
||
82 | * |
||
83 | * @param string $message |
||
84 | * @return void |
||
85 | */ |
||
86 | protected function info(string $message) |
||
90 | |||
91 | /** |
||
92 | * Trigger a Warning message. |
||
93 | * |
||
94 | * @param string $message |
||
95 | * @return void |
||
96 | */ |
||
97 | protected function warn(string $message) |
||
107 | |||
108 | /** |
||
109 | * Trigger an Error message. |
||
110 | * |
||
111 | * @param string $message |
||
112 | * @return void |
||
113 | */ |
||
114 | protected function error(string $message) |
||
118 | |||
119 | protected function line(string $message, string $style) |
||
125 | } |
||
126 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.