function __construct($text = null, $attributes = array()) { if ($text && is_string($text)) { $textNode = new DOMText($text); $this->addChild($textNode); } parent::__construct('legend', $attributes); }
public function __construct($text = null) { if ($text) { if (!is_string($text)) { throw new Exception("The argument is not a string."); } $this->addChild(new DOMText($text)); } parent::__construct('label'); }
public function __construct($attributes = array()) { parent::__construct($this->tagName, $attributes); }
/** * * @param string $name * @param array $attributes * * valid attributes: * - name * - type * - value * - hint * - tooltip * - disabled * - readonly * - placeholder */ public function __construct() { $args = func_get_args(); $attributes = array(); // new FooInput('name',array( ...attributes ... )); if (2 === count($args)) { $this->name = $args[0]; if ($args[1] && is_array($args[1])) { $attributes = $args[1]; } } elseif (1 === count($args)) { $arg = $args[0]; if (is_string($arg)) { $this->name = $arg; } elseif (is_array($arg)) { $attributes = $arg; } else { throw new InvalidArgumentException('Unsupported argument type'); } } if (!$this->tagName) { throw new Exception("tagName is not defined in " . get_class($this)); } parent::__construct($this->tagName, $attributes); // create element }
public function __construct($text) { $this->append($text); parent::__construct($this->tagName); }