| Total Complexity | 4 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | class Message |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * Message, either a string or list of string for multiple lines |
||
| 26 | * |
||
| 27 | * @var string|array<string> |
||
| 28 | */ |
||
| 29 | private string|array $message; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Should message be ended with a new line character |
||
| 33 | * |
||
| 34 | * @var bool |
||
| 35 | */ |
||
| 36 | private bool $newLine; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Current application verbosity |
||
| 40 | * |
||
| 41 | * @var int |
||
| 42 | */ |
||
| 43 | private int $verbosity; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Constructor |
||
| 47 | * |
||
| 48 | * @param string|array<string> $message |
||
| 49 | * @param bool $newLine |
||
| 50 | * @param int $verbosity |
||
| 51 | */ |
||
| 52 | 24 | public function __construct(string|array $message, bool $newLine, int $verbosity) |
|
| 53 | { |
||
| 54 | 24 | $this->message = $message; |
|
| 55 | 24 | $this->newLine = $newLine; |
|
| 56 | 24 | $this->verbosity = $verbosity; |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Returns the message to print |
||
| 61 | * |
||
| 62 | * @return string|array<string> |
||
| 63 | */ |
||
| 64 | 9 | public function message(): string|array |
|
| 65 | { |
||
| 66 | 9 | return $this->message; |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * If true message should end with a new line |
||
| 71 | * |
||
| 72 | * @return bool |
||
| 73 | */ |
||
| 74 | 9 | public function newLine(): bool |
|
| 75 | { |
||
| 76 | 9 | return $this->newLine; |
|
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Minimum verbosity this message should be displayed at |
||
| 81 | * |
||
| 82 | * @return int |
||
| 83 | */ |
||
| 84 | 23 | public function verbosity(): int |
|
| 87 | } |
||
| 88 | } |
||
| 89 |