Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 47.37% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | class BuilderRequireEncoder implements Encoder |
||
13 | { |
||
14 | 11 | public function getDefaultOptions(): array |
|
17 | } |
||
18 | |||
19 | 11 | public function supports($value): bool |
|
20 | { |
||
21 | 11 | if (!$value instanceof Closure) { |
|
22 | 8 | return false; |
|
23 | } |
||
24 | 10 | $reflection = new ReflectionClosure($value); |
|
25 | |||
26 | 10 | $closureReflection = $reflection->getClosureScopeClass(); |
|
27 | 10 | $closureClassOwnerName = $closureReflection->getName(); |
|
28 | |||
29 | 10 | return is_a($closureClassOwnerName, Builder::class, true); |
|
30 | } |
||
31 | |||
32 | public function encode($value, $depth, array $options, callable $encode) |
||
44 | ), |
||
45 | ); |
||
48 |