/** * @param string|Text $content * @param array $options * * @return string */ public function renderLink($content, array $options = array()) { $options = $this->createResolver()->setRequired(array('href'))->setDefaults(array('href' => '#', 'title' => ''))->setAllowedTypes(array('href' => 'string', 'title' => 'string'))->resolve($options); $tag = new Tag('a'); $tag->setText($content); $tag->setAttribute('href', $options['href']); if ($options['title']) { $tag->setAttribute('title', $options['title']); } return $tag->render(); }
/** * @param Collection $rules * * @return Collection|\Ciconia\Common\Tag[] */ protected function createBaseTags(Collection $rules) { /* @var Collection|Tag[] $baseTags */ $baseTags = new Collection(); $rules->each(function (Text $cell) use(&$baseTags) { $cell->trim(); $tag = new Tag('td'); if ($cell->match('/^-.*:$/')) { $tag->setAttribute('align', 'right'); } elseif ($cell->match('/^:.*:$/')) { $tag->setAttribute('align', 'center'); } $baseTags->add($tag); }); return $baseTags; }