-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #562 from patchlevel/add-has-header
add has header and add only header if used
- Loading branch information
Showing
26 changed files
with
142 additions
and
306 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 was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
src/Message/Translator/ExcludeEventWithHeaderTranslator.php
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Message\Translator; | ||
|
||
use Patchlevel\EventSourcing\Message\Message; | ||
|
||
final class ExcludeEventWithHeaderTranslator implements Translator | ||
{ | ||
/** @param class-string $header */ | ||
public function __construct( | ||
private readonly string $header, | ||
) { | ||
} | ||
|
||
/** @return list<Message> */ | ||
public function __invoke(Message $message): array | ||
{ | ||
if ($message->hasHeader($this->header)) { | ||
return []; | ||
} | ||
|
||
return [$message]; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Message/Translator/IncludeEventWithHeaderTranslator.php
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Message\Translator; | ||
|
||
use Patchlevel\EventSourcing\Message\Message; | ||
|
||
final class IncludeEventWithHeaderTranslator implements Translator | ||
{ | ||
/** @param class-string $header */ | ||
public function __construct( | ||
private readonly string $header, | ||
) { | ||
} | ||
|
||
/** @return list<Message> */ | ||
public function __invoke(Message $message): array | ||
{ | ||
if ($message->hasHeader($this->header)) { | ||
return [$message]; | ||
} | ||
|
||
return []; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Store; | ||
|
||
/** @psalm-immutable */ | ||
final class StreamStartHeader | ||
{ | ||
} |
Oops, something went wrong.