/** * @param array|string|self $input * @return static */ public static function cast($input, callable $escape = null) { if ($input instanceof self) { $input->setEscape($escape); } else { $input = new static($input, $escape); } return $input; }
/** * @param array|Attributes $attribs * @return Attributes */ protected function attribs($attribs) { return Attributes::cast($attribs, $this->escape); }
/** * Helper function for the Element nodes * * @param array $attributes * @return string */ public function renderAttr(array $attributes) { $helper = new Attributes($attributes, $this->escape); return $helper->toString(); }
public function testRender() { $attr = new Attributes(['href' => '#', 'data-special' => "123"]); $exp = ' href="#" data-special="123"'; $this->assertEquals($exp, $attr->toString()); }