blob: a7d2a6326c2ad21595903a4f785242c03b56398e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php
class PlanetError
{
public int $level;
/** @var array<int, string> */
public $levels = array(
1 => 'notice',
2 => 'warning',
3 => 'error',
);
public string $message;
/**
* PlanetError constructor.
*/
public function __construct(int $level, string $message)
{
$this->level = (int) $level;
$this->message = $message;
}
public function toString(string $format = '%1$s: %2$s') : string
{
return sprintf($format, $this->levels[$this->level], $this->message);
}
}
|