/** * Sets the option tag's value * @param string $value */ public function setValue($value) { $str = new \Variable\String(is_numeric($value) ? (string) $value : $value, 'value'); $this->value = $str->getStripped(); }
public function setHost($host) { $this->host->set($host); }
/** * Adds a data attribute to the tag: * Example: * <code> * $tag = new Tag('p', 'hello'); * $tag->addData('foo-bar', 1); * var_dump($tag->__toString()); * // echoes <p data-foo-bar="1">hello</p> * </code> * @param string $name * @param string $value */ public function addData($name, $value) { if (is_numeric($value)) { $value = (string) $value; } $oName = new \Variable\Attribute($name, 'dataNameAttribute'); $oValue = new \Variable\String($value, 'dataValueAttribute'); $this->data[$oName->get()] = $oValue->get(); }