示例#1
0
 public function addTag(TagInterface $tag)
 {
     if (!$tag instanceof ExifTagInterface) {
         throw new \InvalidArgumentException(sprintf('The tag "%s" must be implement Exifer\\Exif\\ExifTagInterface', $tag->getTagName()));
     }
     return parent::addTag($tag);
 }
 /**
  * @param TagInterface $tag
  * @param string $content
  * @return string
  */
 public function render(TagInterface $tag, $content = '')
 {
     $result = $this->template;
     $result = str_replace('{content}', $content, $result);
     $result = str_replace('{value}', $tag->getValue(), $result);
     foreach ($tag->getAttributes() as $name => $value) {
         $result = str_replace('{' . $name . '}', $value, $result);
     }
     return $result;
 }
 /**
  * @param TagInterface $tag
  * @param string $content
  * @return string
  */
 public function render(TagInterface $tag, $content = '')
 {
     $result = '';
     $result .= '<' . $this->getId();
     $value = $tag->getValue();
     if (!empty($value)) {
         $result .= '="' . $value . '"';
     }
     $result .= $this->renderAttributes($tag);
     $result .= $this->renderTagFinish($tag, $content);
     return $result;
 }
示例#4
0
 public function test(TagInterface $tag) : bool
 {
     $matches = true;
     if (is_null($this->tag) === false) {
         if ($this->tag != $tag->getTag()) {
             $matches = false;
         }
     }
     if (is_null($this->class) === false) {
         if ($tag->hasClass($this->class) === false) {
             $matches = false;
         }
     }
     if (is_null($this->attributeName) === false) {
         if ($this->attributeValue != $tag->get($this->attributeName)) {
             $matches = false;
         }
     }
     return $matches;
 }
示例#5
0
 /**
  * Renders the list of attributes including the leading space.
  *
  * @param TagInterface $tag
  * @return string
  */
 protected function renderAttributes(TagInterface $tag)
 {
     $result = '';
     foreach ($tag->getAttributes() as $key => $value) {
         $result .= ' ' . $key . '="' . $value . '"';
     }
     return $result;
 }
示例#6
0
 public function add(TagInterface $tag)
 {
     $this->tags[$tag->getName()] = $tag;
 }
示例#7
0
 /**
  * @param $slug
  *
  * @return mixed
  */
 public function getArticlesBySlug($slug)
 {
     return $this->tag->getArticlesBySlug($slug);
 }
示例#8
0
 public function addTag(TagInterface $tag)
 {
     $this->map[(int) $tag->getTagOffset()] = $tag;
 }