Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#28] Create FeatureWasRemoved event and record it inside Feature Class
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Pheature\Core\Toggle\Write\Event; | ||
|
||
use DateTimeImmutable; | ||
use Pheature\Core\Toggle\Write\FeatureId; | ||
|
||
final class FeatureWasRemoved | ||
{ | ||
private string $featureId; | ||
private DatetimeImmutable $occurredAt; | ||
|
||
public function __construct(string $featureId, DatetimeImmutable $occurredAt) | ||
{ | ||
$this->featureId = $featureId; | ||
$this->occurredAt = $occurredAt; | ||
} | ||
|
||
public static function occur(string $featureId): self | ||
{ | ||
return new self($featureId, new DatetimeImmutable()); | ||
} | ||
|
||
public function featureId(): FeatureId | ||
{ | ||
return FeatureId::fromString($this->featureId); | ||
} | ||
|
||
public function occurredAt(): DatetimeImmutable | ||
{ | ||
return $this->occurredAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters