* @author Dennis Eichhorn * @copyright 2013 Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 * @link http://orange-management.com */ namespace phpOMS\Model\Html; use phpOMS\Contract\RenderableInterface; /** * Meta class. * * @category Framework * @package phpOMS/Model * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 * @link http://orange-management.com * @since 1.0.0 */ class Meta implements RenderableInterface { /** * Keywords. * * @var string[] * @since 1.0.0 */ private $keywords = []; /** * Author. * * @var string * @since 1.0.0 */ private $author = null; /** * Charset. * * @var string * @since 1.0.0 */ private $charset = null; /** * Description. * * @var string * @since 1.0.0 */ private $description = null; /** * Language. * * @var string * @since 1.0.0 */ private $language = 'en'; /** * Add keyword. * * @param string $keyword Keyword * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function addKeyword(string $keyword) { if (!in_array($keyword, $this->keywords)) { $this->keywords[] = $keyword; } } /** * Get keywords. * * @return string[] Keywords * * @since 1.0.0 * @author Dennis Eichhorn */ public function getKeywords() : array { return $this->keywords; } /** * Get author. * * @return string Author * * @since 1.0.0 * @author Dennis Eichhorn */ public function getAuthor() : string { return $this->author; } /** * Set author. * * @param string $author Author * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setAuthor(string $author) { $this->author = $author; } /** * Get charset. * * @return string Charset * * @since 1.0.0 * @author Dennis Eichhorn */ public function getCharset() : string { return $this->charset; } /** * Set charset. * * @param string $charset Charset * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setCharset(string $charset) { $this->charset = $charset; } /** * Get description. * * @return string Descritpion * * @since 1.0.0 * @author Dennis Eichhorn */ public function getDescription() : string { return $this->description; } /** * Set description. * * @param string $description Meta description * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setDescription(string $description) { $this->description = $description; } /** * Get language. * * @return string Language * * @since 1.0.0 * @author Dennis Eichhorn */ public function getLanguage() : string { return $this->language; } /** * Set language. * * @param string $language Language * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setLanguage(string $language) { $this->language = $language; } /** * {@inheritdoc} */ public function render() : string { return (count($this->keywords) > 0 ? '"' : '') . (isset($this->author) ? '' : '') . (isset($this->description) ? '' : '') . (isset($this->charset) ? '' : '') . ''; } }