QueryPath\CSS\DOMTraverser::matchClasses PHP Method

matchClasses() protected method

Check that the given DOMNode has all of the given classes.
protected matchClasses ( $node, $classes )
    protected function matchClasses($node, $classes)
    {
        if (empty($classes)) {
            return true;
        }
        if (!$node->hasAttribute('class')) {
            return false;
        }
        $eleClasses = preg_split('/\\s+/', $node->getAttribute('class'));
        if (empty($eleClasses)) {
            return false;
        }
        // The intersection should match the given $classes.
        $missing = array_diff($classes, array_intersect($classes, $eleClasses));
        return count($missing) == 0;
    }