Conditions | 5 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
35 | 1 | public function sanitize($data) |
|
36 | { |
||
37 | 1 | $this->validator->assert($data); |
|
38 | 1 | if (!$this->T || !class_exists($this->T)) return $data; |
|
39 | 1 | $refl = $this->getReflectionClass(); |
|
40 | 1 | $instance = $refl->newInstanceWithoutConstructor(); |
|
41 | 1 | foreach ($refl->getProperties() as $reflectionProperty) { |
|
42 | 1 | $propertyName = $reflectionProperty->getName(); |
|
43 | 1 | if (isset($data[$propertyName])) { |
|
44 | 1 | $reflectionProperty->setAccessible(true); |
|
45 | 1 | $reflectionProperty->setValue($instance, $data[$propertyName]); |
|
46 | } |
||
47 | } |
||
48 | 1 | return $instance; |
|
49 | } |
||
50 | |||
62 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.