We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 73d0bd8 commit 60b4f54Copy full SHA for 60b4f54
src/WorkflowManager.php
@@ -8,4 +8,11 @@
8
abstract class WorkflowManager implements WorkflowInterface
9
{
10
use WorkflowTraits;
11
+
12
+ protected function when(bool $condition, callable $callback)
13
+ {
14
+ if ($condition) {
15
+ $callback();
16
+ }
17
18
}
tests/Helpers/DummyWorkflow.php
@@ -28,15 +28,12 @@ public function handle(array $context)
28
29
$this->addAfterAction(new DummyJob());
30
31
- if ($this->trackEvents) {
32
- $this->trackAllEvents();
33
- }
34
-
35
- if ($this->registerObservers) {
+ $this->when($this->trackEvents, fn () => $this->trackAllEvents());
+ $this->when($this->registerObservers, function () {
36
$this->registerObservers([
37
DummyModel::class => DummyModelObserver::class,
38
]);
39
+ });
40
41
42
0 commit comments