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