public function getAttribute($key) { if (!isset($this->attr[$key])) { return null; } $value = $this->attr[$key]['value']; if (is_string($value) && !is_null($this->encode)) { // convert charset $this->attr[$key]['value'] = $this->encode->convert($value); } return $this->attr[$key]; }
public function testSetAttributes() { $attr = ['href' => ['value' => 'http://google.com', 'doublequote' => false]]; $tag = new Tag('a'); $tag->setAttributes($attr); $this->assertEquals('http://google.com', $tag->getAttribute('href')['value']); }