public function test(TagInterface $tag) : bool { $matches = true; if (is_null($this->tag) === false) { if ($this->tag != $tag->getTag()) { $matches = false; } } if (is_null($this->class) === false) { if ($tag->hasClass($this->class) === false) { $matches = false; } } if (is_null($this->attributeName) === false) { if ($this->attributeValue != $tag->get($this->attributeName)) { $matches = false; } } return $matches; }