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