1: <?php
2: namespace phpcassa\Schema\DataType;
3:
4: use phpcassa\Schema\DataType\Serialized;
5:
6: 7: 8: 9: 10:
11: class DoubleType extends CassandraType implements Serialized
12: {
13: public function pack($value, $is_name=true, $slice_end=null, $is_data=false) {
14: if ($is_name && $is_data)
15: $value = unserialize($value);
16: return strrev(pack("d", $value));
17: }
18:
19: public function unpack($data, $is_name=true) {
20: $value = current(unpack("d", strrev($data)));
21: if ($is_name) {
22: return serialize($value);
23: } else {
24: return $value;
25: }
26: }
27: }
28: