Total Complexity | 3 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Result |
||
8 | { |
||
9 | private function __construct() |
||
10 | { |
||
11 | } |
||
12 | |||
13 | final public static function just($value) |
||
14 | { |
||
15 | return new class($value) extends Result implements Just { |
||
16 | private $value; |
||
17 | |||
18 | public function __construct($value) |
||
22 | |||
23 | public function get() |
||
27 | }; |
||
28 | } |
||
29 | |||
30 | final public static function notFound() |
||
31 | { |
||
32 | return new class() extends Result implements NotFound {}; |
||
33 | } |
||
34 | |||
35 | final public static function exception(\Throwable $exception) |
||
36 | { |
||
37 | return new class($exception) extends Result implements Exception { |
||
38 | private $exception; |
||
39 | |||
40 | public function __construct(\Throwable $exception) |
||
44 | |||
45 | public function inner() : \Throwable |
||
49 | }; |
||
50 | } |
||
51 | } |
||
52 |