Ejemplo n.º 1
0
 public function indexAction($type)
 {
     $this->setType($type);
     $this->setUrlXml($this->getType());
     $xml = file_get_contents($this->getUrlXml());
     $xmlBuilder = new XmlBuilder();
     $xml_dom = $xmlBuilder->loadXML($xml, true);
     $data = $xmlBuilder->toArray($xml_dom);
     unset($data['rss']['channel']['title'], $data['rss']['channel']['link'], $data['rss']['channel']['description'], $data['rss']['channel']['language']);
     $data = $data['rss']['channel'];
     if (!is_array($data['item'][0])) {
         $data = array('item' => array($data['item']));
     }
     foreach ($data['item'] as $key => $item) {
         $data['item'][$key] = array('title' => $this->getTitle(), 'description' => $item['description'], 'image' => $item['linkfoto']);
     }
     $xmlBuilder->load($data);
     $xml_output = $xmlBuilder->createXML(true);
     $finfo = new \finfo(FILEINFO_MIME_TYPE);
     $this->app->response->header('Content-Type', 'content-type: ' . $finfo->buffer($xml_output));
     echo $xml_output;
 }
Ejemplo n.º 2
0
 /**
  * Parse the raw data response from gateway
  *
  * @param string $body
  */
 private function parse($body)
 {
     $xmlbuilder = new XmlBuilder();
     $xml = $xmlbuilder->loadXML($body, true);
     $request = $xmlbuilder->toArray($xml);
     return $request['Response'];
 }
Ejemplo n.º 3
0
 private function builderSoapEnvelope(&$data)
 {
     $xml = new XmlBuilder('soap:Envelope', new XmlNormalizer());
     $data['@attributes'] = $this->SOAP_ATTRIBUTES;
     $xml->load($this->soap);
     $xml->setRenderTypeAttributes(false);
     $request = $xml->createXML(true);
     $request = str_replace("soapBody", "soap:Body", $request);
     return $request;
 }
Ejemplo n.º 4
0
 /**
  * @test
  */
 public function testGetNormalizerShouldReturnInstanceOfNormalizerInterface()
 {
     $builder = new XmlBuilder();
     $this->assertInstanceof('Thapp\\XmlBuilder\\NormalizerInterface', $builder->getNormalizer());
 }