Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
9 / 9 |
| Status | |
100.00% |
1 / 1 |
|
100.00% |
8 / 8 |
8 | |
100.00% |
9 / 9 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| fromString | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| status | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| waiting | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| delivered | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| canceled | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| toString | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| __toString | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| declare(strict_types=1); | |
| namespace App\Order\Domain\ValueObject; | |
| final class Status | |
| { | |
| public const WAITING = 'waiting'; | |
| public const DELIVERED = 'delivered'; | |
| public const CANCELED = 'canceled'; | |
| private string $status; | |
| public function __construct(string $status) | |
| { | |
| $this->status = $status; | |
| } | |
| public static function fromString(string $status): self | |
| { | |
| return new self($status); | |
| } | |
| public function status(): string | |
| { | |
| return $this->status; | |
| } | |
| public static function waiting(): self | |
| { | |
| return new static(self::WAITING); | |
| } | |
| public static function delivered(): self | |
| { | |
| return new static(self::DELIVERED); | |
| } | |
| public static function canceled(): self | |
| { | |
| return new static(self::CANCELED); | |
| } | |
| public function toString(): string | |
| { | |
| return $this->status; | |
| } | |
| public function __toString(): string | |
| { | |
| return $this->status; | |
| } | |
| } |