Total Complexity | 15 |
Total Lines | 96 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
4 | final class ErrorMessages |
||
5 | { |
||
6 | /** |
||
7 | * @static ErrorMessages |
||
8 | */ |
||
9 | private static $instance = null; |
||
10 | |||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | private $items = []; |
||
15 | |||
16 | private function __construct() |
||
17 | { |
||
18 | } |
||
19 | |||
20 | private function __clone() |
||
21 | { |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Casting to string method. |
||
26 | * |
||
27 | * @return string |
||
28 | */ |
||
29 | public function __toString() |
||
30 | { |
||
31 | return $this->toString(false); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return ErrorMessages |
||
36 | */ |
||
37 | public static function instance() |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param string $msg |
||
49 | */ |
||
50 | public function add($msg) |
||
54 | } |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return array |
||
59 | */ |
||
60 | public function errors() |
||
61 | { |
||
62 | $this->items; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Empties the error content. |
||
67 | */ |
||
68 | public function reset() |
||
69 | { |
||
70 | $this->items = []; |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @param bool $web |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function toString($web = false) |
||
100 | } |
||
101 | } |
||
102 |