@@ 51-56 (lines=6) @@ | ||
48 | */ |
|
49 | public function serialize($data, $format, array $context = array()) |
|
50 | { |
|
51 | if (!isset($this->handlers[$format])) { |
|
52 | throw new \BadMethodCallException(sprintf( |
|
53 | 'Unsupported format "%s", only [%s] are', |
|
54 | $format, implode(', ', array_keys($this->handlers)) |
|
55 | )); |
|
56 | } |
|
57 | ||
58 | return $this->handlers[$format]->serialize( |
|
59 | $data, |
|
@@ 71-76 (lines=6) @@ | ||
68 | */ |
|
69 | public function deserialize($data, $type, $format, array $context = array()) |
|
70 | { |
|
71 | if (!isset($this->handlers[$format])) { |
|
72 | throw new \BadMethodCallException(sprintf( |
|
73 | 'Unsupported format "%s", only [%s] are', |
|
74 | $format, implode(', ', array_keys($this->handlers)) |
|
75 | )); |
|
76 | } |
|
77 | ||
78 | return $this->handlers[$format]->deserialize($data, $type); |
|
79 | } |