Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
17 | 6 | public function supports(object $object, string $property): bool |
|
18 | { |
||
19 | 6 | $refl = new \ReflectionObject($object); |
|
20 | |||
21 | 6 | $property = Str::of($property) |
|
22 | 6 | ->camelize() |
|
23 | 6 | ->toString(); |
|
24 | |||
25 | 6 | if (!$refl->hasMethod($property)) { |
|
26 | 4 | return false; |
|
27 | } |
||
28 | |||
29 | 4 | $property = $refl->getMethod($property); |
|
30 | |||
31 | 4 | if (!$property->isPublic()) { |
|
32 | 1 | return false; |
|
33 | } |
||
34 | |||
35 | 4 | return $property->getNumberOfRequiredParameters() === 0; |
|
36 | } |
||
55 |