|
@@ 120-129 (lines=10) @@
|
| 117 |
|
|
| 118 |
|
/* --- SERIALIZATION --------------------------------------------------- */ |
| 119 |
|
|
| 120 |
|
public function serialize(ShortcodeInterface $shortcode, $format) |
| 121 |
|
{ |
| 122 |
|
switch($format) { |
| 123 |
|
case 'text': return $this->textSerializer->serialize($shortcode); |
| 124 |
|
case 'json': return $this->jsonSerializer->serialize($shortcode); |
| 125 |
|
case 'yaml': return $this->yamlSerializer->serialize($shortcode); |
| 126 |
|
case 'xml': return $this->xmlSerializer->serialize($shortcode); |
| 127 |
|
default: throw new \InvalidArgumentException(sprintf('Invalid serialization format %s!', $format)); |
| 128 |
|
} |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
public function unserialize($text, $format) |
| 132 |
|
{ |
|
@@ 131-140 (lines=10) @@
|
| 128 |
|
} |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
public function unserialize($text, $format) |
| 132 |
|
{ |
| 133 |
|
switch($format) { |
| 134 |
|
case 'text': return $this->textSerializer->unserialize($text); |
| 135 |
|
case 'json': return $this->jsonSerializer->unserialize($text); |
| 136 |
|
case 'yaml': return $this->yamlSerializer->unserialize($text); |
| 137 |
|
case 'xml': return $this->xmlSerializer->unserialize($text); |
| 138 |
|
default: throw new \InvalidArgumentException(sprintf('Invalid unserialization format %s!', $format)); |
| 139 |
|
} |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** @deprecated use serialize($shortcode, $format) */ |
| 143 |
|
public function serializeToText(ShortcodeInterface $s) { return $this->serialize($s, 'text'); } |