1 | <?php |
||||||
2 | |||||||
3 | namespace Imanghafoori\HeyMan\Reactions; |
||||||
4 | |||||||
5 | final class Validator |
||||||
6 | { |
||||||
7 | private $validationData; |
||||||
8 | |||||||
9 | private $modifier; |
||||||
10 | |||||||
11 | 8 | public function __construct(array $validationData) |
|||||
12 | { |
||||||
13 | 8 | $this->validationData = $validationData; |
|||||
14 | 8 | } |
|||||
15 | |||||||
16 | 1 | public function beforeValidationModifyData($callable) |
|||||
17 | { |
||||||
18 | 1 | $this->modifier = $callable; |
|||||
19 | 1 | } |
|||||
20 | |||||||
21 | 8 | public function __destruct() |
|||||
22 | { |
||||||
23 | 8 | $data = $this->validationData; |
|||||
24 | 8 | $modifier = $this->modifier ?: function ($args) { |
|||||
25 | 4 | return $args; |
|||||
26 | 8 | }; |
|||||
27 | 8 | $chain = resolve('heyman.chain'); |
|||||
28 | 8 | $condition = resolve(ResponderFactory::class)->validatorCallback($modifier, ...$data); |
|||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
29 | 8 | $chain->set('condition', $condition); |
|||||
0 ignored issues
–
show
The method
set() does not exist on Illuminate\Foundation\Application .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||||||
30 | 8 | resolve('heyman.chains')->commitChain(); |
|||||
31 | 8 | } |
|||||
32 | } |
||||||
33 |