QueryPath\CSS\QueryPathEventHandler::searchForAttr PHP Метод

searchForAttr() защищенный Метод

Helper function to find all elements with exact matches.
Устаревший: All use cases seem to be covered by attribute().
protected searchForAttr ( $name, $value = null )
    protected function searchForAttr($name, $value = null)
    {
        $found = new \SplObjectStorage();
        $matches = $this->candidateList();
        foreach ($matches as $candidate) {
            if ($candidate->hasAttribute($name)) {
                // If value is required, match that, too.
                if (isset($value) && $value == $candidate->getAttribute($name)) {
                    $found->attach($candidate);
                } else {
                    $found->attach($candidate);
                }
            }
        }
        $this->matches = $found;
    }