From b52881c58a143aaad3d0887ce5e819614e3d200b Mon Sep 17 00:00:00 2001 From: ngasparic Date: Mon, 5 Feb 2024 15:02:43 +0100 Subject: [PATCH 1/2] VSLIV30-2578 add option for continuous matching --- src/Facades/InboxGroup.php | 2 +- src/InboxGroup.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Facades/InboxGroup.php b/src/Facades/InboxGroup.php index 77cee40..542a889 100644 --- a/src/Facades/InboxGroup.php +++ b/src/Facades/InboxGroup.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Facade; /** - * @method static array run(CanMatch $message) + * @method static array run(CanMatch $message, ?bool $continuousMatching=false) * @method static self add(Inbox $inbox) * @method static self fallback($action) * @method static self continuousMatching() diff --git a/src/InboxGroup.php b/src/InboxGroup.php index 99ece5e..78ac0e5 100644 --- a/src/InboxGroup.php +++ b/src/InboxGroup.php @@ -23,13 +23,15 @@ public function add(Inbox $inbox): self } /** - * @param CanMatch $message - * @return array - * - * @throws Exception + * @param CanMatch $message + * @param bool|null $continuousMatching + * @return array|Inbox[]|null[] */ - public function run(CanMatch $message): array + public function run(CanMatch $message, ?bool $continuousMatching = false): array { + if ($continuousMatching){ + $this->continuousMatching(); + } $inboxes = collect($this->inboxes)->sortByDesc('priority'); $matchedInboxes = []; From f199c59f0c1b133f5ea0b0b4f484b967e20a8296 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Mon, 5 Feb 2024 14:03:03 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- src/InboxGroup.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/InboxGroup.php b/src/InboxGroup.php index 78ac0e5..dbffe52 100644 --- a/src/InboxGroup.php +++ b/src/InboxGroup.php @@ -5,7 +5,6 @@ namespace Asseco\Inbox; use Asseco\Inbox\Contracts\CanMatch; -use Exception; class InboxGroup { @@ -23,13 +22,13 @@ public function add(Inbox $inbox): self } /** - * @param CanMatch $message - * @param bool|null $continuousMatching + * @param CanMatch $message + * @param bool|null $continuousMatching * @return array|Inbox[]|null[] */ public function run(CanMatch $message, ?bool $continuousMatching = false): array { - if ($continuousMatching){ + if ($continuousMatching) { $this->continuousMatching(); } $inboxes = collect($this->inboxes)->sortByDesc('priority');