Exemplo n.º 1
0
 /**
  * Create typed post data.
  *
  * @param Attribute         $attr Post attribute.
  * @param \SimpleXMLElement $post Post data xml element.
  * @return \Contrib\Component\Tumblr2Markdown\Response\Type\Type Typed post data.
  */
 protected function createPostData(Attribute $attr, \SimpleXMLElement $post)
 {
     if ($attr->isRegular()) {
         return new Regular($post);
     }
     if ($attr->isQuote()) {
         return new Quote($post);
     }
     if ($attr->isLink()) {
         return new Link($post);
     }
     if ($attr->isPhoto()) {
         return new Photo($post);
     }
     if ($attr->isVideo()) {
         return new Video($post);
     }
     if ($attr->isAudio()) {
         return new Audio($post);
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Return post data.
  *
  * @return array
  */
 public function toArray()
 {
     return array('attribute' => $this->attr->toArray(), 'data' => $this->data->toArray());
 }