Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
5 / 5
OrderWasCanceled
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
5 / 5
 status
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 withData
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
<?php
declare(strict_types=1);
namespace App\Order\Domain\Event;
use App\Order\Domain\ValueObject\OrderId;
use App\Order\Domain\ValueObject\Status;
use Prooph\EventSourcing\AggregateChanged;
final class OrderWasCanceled extends AggregateChanged
{
    private Status $status;
    public function status(): Status
    {
        return Status::fromString($this->payload['status']);
    }
    public static function withData(
        OrderId $orderId,
        Status $status
    ): self {
        $event = self::occur($orderId->toString(), [
            'status' => $status->toString(),
        ]);
        $event->status = $status;
        return $event;
    }
}