| 1 | <?php |
||
| 6 | final class CompletionResult |
||
| 7 | { |
||
| 8 | private const BAD = 'BAD'; |
||
| 9 | |||
| 10 | private const NO = 'NO'; |
||
| 11 | |||
| 12 | private const OK = 'OK'; |
||
| 13 | |||
| 14 | private const ENUM = [ |
||
| 15 | self::BAD => true, |
||
| 16 | self::NO => true, |
||
| 17 | self::OK => true, |
||
| 18 | ]; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | private $result; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $value |
||
| 27 | */ |
||
| 28 | 26 | private function __construct(string $value) |
|
| 41 | |||
| 42 | /** |
||
| 43 | * @param CompletionResult $completionResult |
||
| 44 | * @return bool |
||
| 45 | */ |
||
| 46 | 18 | public function equals(CompletionResult $completionResult): bool |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | 6 | public function __toString(): string |
|
| 58 | |||
| 59 | /** |
||
| 60 | * @param string $result |
||
| 61 | * @return CompletionResult |
||
| 62 | */ |
||
| 63 | 3 | public static function fromString(string $result): self |
|
| 67 | |||
| 68 | /** |
||
| 69 | * @param string $line |
||
| 70 | * @return CompletionResult |
||
| 71 | */ |
||
| 72 | 20 | public static function fromLine(string $line): self |
|
| 82 | |||
| 83 | /** |
||
| 84 | * @return CompletionResult |
||
| 85 | */ |
||
| 86 | 24 | public static function ok(): self |
|
| 90 | } |
||
| 91 |