| Conditions | 7 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function formatPropertyValue($value, string $property) |
||
| 33 | { |
||
| 34 | switch ($this->propertyHolder->getPropertyType($property)) { |
||
| 35 | case PropertyHolder::TYPE_BOOLEAN: |
||
| 36 | if (true === $value || $value === 'true' || $value === '1') { |
||
| 37 | return true; |
||
| 38 | } |
||
| 39 | return false; |
||
| 40 | break; |
||
|
|
|||
| 41 | case PropertyHolder::TYPE_IN_ARRAY: |
||
| 42 | try { |
||
| 43 | return $this->propertyHolder->checkValueInArray($property, $value); |
||
| 44 | } catch (\InvalidArgumentException $ex) { |
||
| 45 | return ''; |
||
| 46 | } |
||
| 47 | break; |
||
| 48 | } |
||
| 49 | |||
| 50 | return $value; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
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.