| Conditions | 6 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 4 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 35 | public function encode($type, $value) |
||
| 36 | { |
||
| 37 | if (!$this->isPrimitive($type)) { |
||
| 38 | if ($value instanceof Contracts\Entity) { |
||
| 39 | return $value->getId(); |
||
| 40 | } |
||
| 41 | |||
| 42 | return +$value; |
||
| 43 | } |
||
| 44 | |||
| 45 | if ($type == 'integer') { |
||
| 46 | return +$value; |
||
| 47 | } |
||
| 48 | |||
| 49 | if (is_null($value)) { |
||
| 50 | return; |
||
| 51 | } |
||
| 52 | |||
| 53 | if (!is_array($value)) { |
||
| 54 | return "$value"; |
||
| 55 | } |
||
| 56 | |||
| 57 | return $value; |
||
| 58 | } |
||
| 59 | |||
| 78 |