Пример #1
0
 /**
  * @param DecoderInterface $decoder
  *
  * @return string
  */
 public function transform(DecoderInterface $decoder)
 {
     $xml = new \SimpleXMLElement('<xml/>');
     foreach ($decoder->getData() as $key => $value) {
         if (is_array($value)) {
             if (is_numeric($key)) {
                 $items = $xml->addChild('items');
                 $item = $items->addChild('item');
             } else {
                 $item = $xml->addChild($key);
             }
             foreach ($value as $k => $v) {
                 if (is_array($v)) {
                     continue;
                 }
                 $item->addChild($k, $v);
             }
             continue;
         }
         $xml->addChild($key, $value);
     }
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->preserveWhiteSpace = false;
     $dom->formatOutput = true;
     $dom->loadXML($xml->asXML());
     return $dom->saveXML();
 }
 /**
  * @param DecoderInterface $decoder
  *
  * @return string
  */
 public function transform(DecoderInterface $decoder)
 {
     return serialize($decoder->getData());
 }
Пример #3
0
 /**
  * @param DecoderInterface $decoder
  *
  * @return string
  */
 public function transform(DecoderInterface $decoder)
 {
     return print_r($decoder->getData(), true);
 }
 /**
  * @param DecoderInterface $decoder
  *
  * @return string
  */
 public function transform(DecoderInterface $decoder)
 {
     return base64_decode($decoder->getData());
 }
Пример #5
0
 /**
  * @param DecoderInterface $decoder
  *
  * @return string
  */
 public function transform(DecoderInterface $decoder)
 {
     return json_encode($decoder->getData(), JSON_PRETTY_PRINT);
 }
 /**
  * @param DecoderInterface $decoder
  *
  * @return string
  */
 public function transform(DecoderInterface $decoder)
 {
     return $this->markdown->parse($decoder->getData());
 }