src/PHPHtmlParser/Selector/Selector.php
public function checkComparison(array $rule, AbstractNode $node): bool
    {
        if ($rule['key'] == 'plaintext') {
            // plaintext search
            $nodeValue = $node->text();
        } else {
            // normal search
            $nodeValue = $node->getAttribute($rule['key']);
        }

        $check = $this->match($rule['operator'], $rule['value'], $nodeValue);

        // handle multiple classes
        if ( ! $check && $rule['key'] == 'class') {
            $nodeClasses = explode(' ', $node->getAttribute('class'));
            foreach ($nodeClasses as $class) {
                if ( ! empty($class)) {
                    $check = $this->match($rule['operator'], $rule['value'], $class);
                }
                if ($check) {
                    break;
                }
            }
        }

        return $check;
    }
public function checkComparison(array $rule, AbstractNode $node): bool
    {
        if ($rule['key'] == 'plaintext') {
            // plaintext search
            $nodeValue = $node->text();
        } else {
            // normal search
            $nodeValue = $node->getAttribute($rule['key']);
        }

        $check = $this->match($rule['operator'], $rule['value'], $nodeValue);

        // handle multiple classes
        if ( ! $check && $rule['key'] == 'class') {
            $nodeClasses = explode(' ', $node->getAttribute('class'));
            foreach ($nodeClasses as $class) {
                if ( ! empty($class)) {
                    $check = $this->match($rule['operator'], $rule['value'], $class);
                }
                if ($check) {
                    break;
                }
            }
        }

        return $check;
    }
public function checkComparison ( array $ rule , AbstractNode $ node ) : bool { if ( $ rule [ 'key' ] == 'plaintext' ) { // plaintext search $ nodeValue = $ node -> text ( ) ; } else { // normal search $ nodeValue = $ node -> getAttribute ( $ rule [ 'key' ] ) ; } $ check = $ this -> match ( $ rule [ 'operator' ] , $ rule [ 'value' ] , $ nodeValue ) ; // handle multiple classes if ( ! $ check && $ rule [ 'key' ] == 'class' ) { $ nodeClasses = explode ( ' ' , $ node -> getAttribute ( 'class' ) ) ; foreach ( $ nodeClasses as $ class ) { if ( ! empty ( $ class ) ) { $ check = $ this -> match ( $ rule [ 'operator' ] , $ rule [ 'value' ] , $ class ) ; } if ( $ check ) { break ; } } } return $ check ; }
Checks comparison condition from rules against node.

@param array $rule
@param AbstractNode $node
@return bool
Checks comparison condition from rules against node .