-
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.
[TransactionalMessenger] Added possibility to specify more than one c…
…ommit types for message
- Loading branch information
1 parent
4a01552
commit 8e4aef5
Showing
4 changed files
with
40 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace FRZB\Component\TransactionalMessenger\Helper; | ||
|
||
use Fp\Collections\ArrayList; | ||
use FRZB\Component\TransactionalMessenger\Enum\CommitType; | ||
use FRZB\Component\TransactionalMessenger\ValueObject\PendingEnvelope; | ||
use JetBrains\PhpStorm\Immutable; | ||
|
||
/** @internal */ | ||
#[Immutable] | ||
final class TransactionHelper | ||
{ | ||
private function __construct() | ||
{ | ||
} | ||
|
||
public static function isDispatchAllowed(PendingEnvelope $envelope, CommitType ...$commitTypes): bool | ||
{ | ||
return ArrayList::collect($envelope->getAttribute()->commitTypes) | ||
->filter(static fn (CommitType $ct) => \in_array($ct, $commitTypes, true)) | ||
->isNonEmpty() | ||
; | ||
} | ||
} |
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