Exemplo n.º 1
0
 /**
  * @param  NodeInterface $node
  * @return $this
  */
 protected function writeInternal(NodeInterface $node)
 {
     $len = 1;
     if ($node->getAttributes() != null) {
         $len += count($node->getAttributes()) * 2;
     }
     if (count($node->getChildren()) > 0) {
         $len += 1;
     }
     if (strlen($node->getData()) > 0) {
         $len += 1;
     }
     $this->writeListStart($len);
     $this->writeString($node->getName());
     $this->writeAttributes($node->getAttributes());
     if (strlen($node->getData()) > 0) {
         $this->writeBytes($node->getData());
     }
     if ($node->getChildren()) {
         $this->writeListStart(count($node->getChildren()));
         foreach ($node->getChildren() as $child) {
             $this->writeInternal($child);
         }
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * @param  NodeInterface  $node
  * @return MediaInterface
  */
 public function createMedia(NodeInterface $node)
 {
     $media = new Location();
     $media->setType($node->getAttribute('type'));
     $media->setEncoding($node->getAttribute('encoding'));
     $media->setName($node->getAttribute('name'));
     $media->setLongitude((double) $node->getAttribute('longitude'));
     $media->setLatitude((double) $node->getAttribute('latitude'));
     $media->setUrl($node->getAttribute('url'));
     $media->setData($node->getData());
     return $media;
 }
Exemplo n.º 3
0
 /**
  * @param  NodeInterface  $node
  * @return MediaInterface
  */
 public function createMedia(NodeInterface $node)
 {
     $media = new Image();
     $media->setType($node->getAttribute('type'));
     $media->setIp($node->getAttribute('ip'));
     $media->setData($node->getData());
     $media->setUrl($node->getAttribute('url'));
     $media->setFile($node->getAttribute('file'));
     $media->setMimeType($node->getAttribute('mimetype'));
     $media->setFileHash($node->getAttribute('filehash'));
     $media->setWidth($this->convertIntIfValid($node->getAttribute('width')));
     $media->setHeight($this->convertIntIfValid($node->getAttribute('height')));
     $media->setSize($this->convertIntIfValid($node->getAttribute('size')));
     $media->setEncoding($node->getAttribute('encoding'));
     return $media;
 }
Exemplo n.º 4
0
 /**
  * @param  NodeInterface  $node
  * @return MediaInterface
  */
 public function createMedia(NodeInterface $node)
 {
     $media = new Audio();
     $media->setType($node->getAttribute('type'));
     $media->setIp($node->getAttribute('ip'));
     $media->setData($node->getData());
     $media->setUrl($node->getAttribute('url'));
     $media->setFile($node->getAttribute('file'));
     $media->setMimeType($node->getAttribute('mimetype'));
     $media->setFileHash($node->getAttribute('filehash'));
     $media->setSize($this->convertIntIfValid($node->getAttribute('size')));
     $media->setSeconds($this->convertIntIfValid($node->getAttribute('seconds')));
     $media->setDuration($this->convertIntIfValid($node->getAttribute('duration')));
     $media->setAudioInfo($this->getAudioInfoFactory()->createInfo($node));
     return $media;
 }