| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 2 | private function toJsonLd(DecimalValue $value) { |
|
| 28 | 2 | $literal = new stdClass(); |
|
| 29 | |||
| 30 | 2 | if($value->getFractionalPart() === '') { |
|
| 31 | 1 | $literal->{'@type'} = 'Integer'; |
|
| 32 | 1 | $literal->{'@value'} = $value->getIntegerPart(); |
|
| 33 | 1 | } else { |
|
| 34 | 1 | $literal->{'@type'} = 'Float'; |
|
| 35 | 1 | $literal->{'@value'} = $value->getValueFloat(); |
|
| 36 | } |
||
| 37 | |||
| 38 | 2 | return $literal; |
|
| 39 | } |
||
| 40 | } |
||
| 41 |