|
@@ 160-169 (lines=10) @@
|
| 157 |
|
* |
| 158 |
|
* @return string |
| 159 |
|
*/ |
| 160 |
|
public function serialize(ShortcodeInterface $shortcode, $format) |
| 161 |
|
{ |
| 162 |
|
switch($format) { |
| 163 |
|
case 'text': return $this->textSerializer->serialize($shortcode); |
| 164 |
|
case 'json': return $this->jsonSerializer->serialize($shortcode); |
| 165 |
|
case 'yaml': return $this->yamlSerializer->serialize($shortcode); |
| 166 |
|
case 'xml': return $this->xmlSerializer->serialize($shortcode); |
| 167 |
|
default: throw new \InvalidArgumentException(sprintf('Invalid serialization format %s!', $format)); |
| 168 |
|
} |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
/** |
| 172 |
|
* @param string $text |
|
@@ 177-186 (lines=10) @@
|
| 174 |
|
* |
| 175 |
|
* @return ShortcodeInterface |
| 176 |
|
*/ |
| 177 |
|
public function unserialize($text, $format) |
| 178 |
|
{ |
| 179 |
|
switch($format) { |
| 180 |
|
case 'text': return $this->textSerializer->unserialize($text); |
| 181 |
|
case 'json': return $this->jsonSerializer->unserialize($text); |
| 182 |
|
case 'yaml': return $this->yamlSerializer->unserialize($text); |
| 183 |
|
case 'xml': return $this->xmlSerializer->unserialize($text); |
| 184 |
|
default: throw new \InvalidArgumentException(sprintf('Invalid unserialization format %s!', $format)); |
| 185 |
|
} |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
/** |
| 189 |
|
* @deprecated use serialize($shortcode, $format) |