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