| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.25 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 1 | public function getDatas(?string $model = null): array { |
|
| 19 | 1 | $datas = URequest::getRealInput (); |
|
| 20 | 1 | if (\count ( $datas ) > 0) { |
|
| 21 | 1 | $datas = \current ( array_keys ( $datas ) ); |
|
| 22 | 1 | $datas = \json_decode ( $datas, true ); |
|
| 23 | 1 | $attributes = $datas ['data'] ['attributes'] ?? [ ]; |
|
| 24 | 1 | if (isset ( $datas ['data'] ['id'] ) && isset($model)) { |
|
| 25 | $key = OrmUtils::getFirstKey ( $model ); |
||
| 26 | $attributes [$key] = $datas ['data'] ['id']; |
||
| 27 | } |
||
| 28 | 1 | $this->loadRelationshipsDatas ( $datas, $attributes, $model ); |
|
| 29 | 1 | return $attributes; |
|
| 30 | } |
||
| 31 | return ['data'=>[]]; |
||
| 32 | } |
||
| 45 | } |