Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public static function binary($value, array $definition){ |
||
24 | $binary = ''; |
||
25 | foreach ($definition as $key => $type) { |
||
26 | if ($value[$key] === null) { |
||
27 | $binary .= "\xff\xff\xff\xff"; |
||
28 | } |
||
29 | else { |
||
30 | $valueBinary = $value[$key] instanceof Base |
||
31 | ? $value[$key]->getBinary() |
||
32 | : Base::getBinaryByType($type, $value[$key]); |
||
33 | |||
34 | $binary .= pack('N', strlen($valueBinary)) . $valueBinary; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | return $binary; |
||
39 | } |
||
40 | |||
51 |