-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description ## Checklist - [ ] Updated CHANGELOG files - [ ] Updated Documentation - [ ] Unit Tests Created - [x] php-cs-fixer
- Loading branch information
1 parent
b9781aa
commit 16fe677
Showing
43 changed files
with
234 additions
and
529 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
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
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 |
---|---|---|
|
@@ -5,13 +5,14 @@ | |
namespace SonsOfPHP\Component\EventSourcing\Aggregate; | ||
|
||
use SonsOfPHP\Component\EventSourcing\Exception\EventSourcingException; | ||
use Stringable; | ||
|
||
/** | ||
* Aggregate ID. | ||
* | ||
* @author Joshua Estes <[email protected]> | ||
*/ | ||
interface AggregateIdInterface extends \Stringable | ||
interface AggregateIdInterface extends Stringable | ||
{ | ||
/** | ||
* Create a new AggregateID. | ||
|
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
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
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 |
---|---|---|
|
@@ -4,7 +4,9 @@ | |
|
||
namespace SonsOfPHP\Component\EventSourcing\Exception; | ||
|
||
use Exception; | ||
|
||
/** | ||
* @author Joshua Estes <[email protected]> | ||
*/ | ||
class AggregateNotFoundException extends \Exception {} | ||
class AggregateNotFoundException extends Exception {} |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ | |
* | ||
* @author Joshua Estes <[email protected]> | ||
*/ | ||
class EventSourcingException extends \Exception {} | ||
class EventSourcingException extends Exception {} |
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
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 |
---|---|---|
|
@@ -4,19 +4,24 @@ | |
|
||
namespace SonsOfPHP\Component\EventSourcing\Message; | ||
|
||
use ArrayIterator; | ||
use Countable; | ||
use DateTimeImmutable; | ||
use IteratorAggregate; | ||
use SonsOfPHP\Component\EventSourcing\Aggregate\AggregateId; | ||
use SonsOfPHP\Component\EventSourcing\Aggregate\AggregateIdInterface; | ||
use SonsOfPHP\Component\EventSourcing\Aggregate\AggregateVersion; | ||
use SonsOfPHP\Component\EventSourcing\Aggregate\AggregateVersionInterface; | ||
use SonsOfPHP\Component\EventSourcing\Exception\EventSourcingException; | ||
use SonsOfPHP\Component\EventSourcing\Metadata; | ||
use Traversable; | ||
|
||
/** | ||
* The Event Message Metadata is stored in here. | ||
* | ||
* @author Joshua Estes <[email protected]> | ||
*/ | ||
final class MessageMetadata implements \IteratorAggregate, \Countable | ||
final class MessageMetadata implements IteratorAggregate, Countable | ||
{ | ||
public function __construct( | ||
private array $metadata = [], | ||
|
@@ -31,9 +36,9 @@ public function __construct( | |
], $metadata); | ||
} | ||
|
||
public function getIterator(): \Traversable | ||
public function getIterator(): Traversable | ||
{ | ||
return new \ArrayIterator($this->metadata); | ||
return new ArrayIterator($this->metadata); | ||
} | ||
|
||
public function count(): int | ||
|
@@ -46,7 +51,7 @@ public function all(): array | |
return $this->metadata; | ||
} | ||
|
||
public function with(string $key, $value) | ||
public function with(string $key, $value): self | ||
{ | ||
$that = clone $this; | ||
$that->metadata[$key] = $value; | ||
|
@@ -87,13 +92,13 @@ public function getEventType(): string | |
return $this->get(Metadata::EVENT_TYPE); | ||
} | ||
|
||
public function getTimestamp(): \DateTimeImmutable | ||
public function getTimestamp(): DateTimeImmutable | ||
{ | ||
if (false === $this->has(Metadata::TIMESTAMP) || null === $this->get(Metadata::TIMESTAMP)) { | ||
throw new EventSourcingException('Timestamp is required.'); | ||
} | ||
|
||
return new \DateTimeImmutable($this->get(Metadata::TIMESTAMP)); | ||
return new DateTimeImmutable($this->get(Metadata::TIMESTAMP)); | ||
} | ||
|
||
public function getTimestampFormat(): string | ||
|
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 |
---|---|---|
|
@@ -4,20 +4,25 @@ | |
|
||
namespace SonsOfPHP\Component\EventSourcing\Message; | ||
|
||
use ArrayIterator; | ||
use Countable; | ||
use IteratorAggregate; | ||
use Traversable; | ||
|
||
/** | ||
* The Event Message Payload is stored in here. | ||
* | ||
* @author Joshua Estes <[email protected]> | ||
*/ | ||
final class MessagePayload implements \IteratorAggregate, \Countable | ||
final class MessagePayload implements IteratorAggregate, Countable | ||
{ | ||
public function __construct( | ||
private array $payload = [], | ||
) {} | ||
|
||
public function getIterator(): \Traversable | ||
public function getIterator(): Traversable | ||
{ | ||
return new \ArrayIterator($this->payload); | ||
return new ArrayIterator($this->payload); | ||
} | ||
|
||
public function count(): int | ||
|
@@ -30,7 +35,7 @@ public function all(): array | |
return $this->payload; | ||
} | ||
|
||
public function with(string $key, $value) | ||
public function with(string $key, $value): self | ||
{ | ||
$that = clone $this; | ||
$that->payload[$key] = $value; | ||
|
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
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
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
Oops, something went wrong.