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