Conditions | 7 |
Paths | 5 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 0 |
1 | <?php |
||
31 | public function formatPropertyValue($value, string $property) |
||
32 | { |
||
33 | switch ($this->propertyHolder->getPropertyType($property)) { |
||
34 | case PropertyHolder::TYPE_BOOLEAN: |
||
35 | if (true === $value || 'true' === $value || '1' === $value) { |
||
36 | return true; |
||
37 | } |
||
38 | |||
39 | return false; |
||
40 | break; |
||
|
|||
41 | case PropertyHolder::TYPE_IN_ARRAY: |
||
42 | try { |
||
43 | return $this->propertyHolder->checkValueInArray($property, (string) $value); |
||
44 | } catch (\InvalidArgumentException $ex) { |
||
45 | return ''; |
||
46 | } |
||
47 | |||
48 | break; |
||
49 | } |
||
50 | |||
51 | return $value; |
||
52 | } |
||
53 | } |
||
54 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.