We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66541f9 commit 14c01feCopy full SHA for 14c01fe
src/ConditionalHandler.php
@@ -32,9 +32,7 @@ final class ConditionalHandler
32
{
33
private array $params = [];
34
35
- private bool|Closure $condition = true;
36
-
37
- public function __construct(private Closure $handler)
+ public function __construct(private Closure $handler, private bool|Closure $condition = true)
38
39
}
40
@@ -75,8 +73,8 @@ public function __invoke(mixed ...$params)
75
73
return $this->resolve(...$params);
76
74
77
78
- public static function make(Closure $fn): self
+ public static function make(Closure $fn, bool|Closure $condition = true): self
79
80
- return new self($fn);
+ return new self($fn, $condition);
81
82
0 commit comments