| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php declare(strict_types=1); |
||
| 12 | public function jsonSerialize(): array |
||
| 13 | { |
||
| 14 | $dsm = static::getDoctrineStaticMeta(); |
||
| 15 | $toSerialize = []; |
||
| 16 | $getters = $dsm->getGetters(); |
||
| 17 | foreach ($getters as $getter) { |
||
| 18 | $got = $this->$getter(); |
||
| 19 | if ($got instanceof UuidInterface) { |
||
| 20 | $got = $got->toString(); |
||
| 21 | } |
||
| 22 | if (false === is_scalar($got)) { |
||
| 23 | continue; |
||
| 24 | } |
||
| 25 | $property = $dsm->getPropertyNameFromGetterName($getter); |
||
| 26 | $toSerialize[$property] = $got; |
||
| 27 | } |
||
| 28 | |||
| 29 | return $toSerialize; |
||
| 30 | } |
||
| 35 | } |