translateDifferent example


    public function getAttributeMatchingTranslators(): array
    {
        return [
            'exists' => $this->translateExists(...),
            '=' => $this->translateEquals(...),
            '~=' => $this->translateIncludes(...),
            '|=' => $this->translateDashMatch(...),
            '^=' => $this->translatePrefixMatch(...),
            '$=' => $this->translateSuffixMatch(...),
            '*=' => $this->translateSubstringMatch(...),
            '!=' => $this->translateDifferent(...),
        ];
    }

    public function translateExists(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
    {
        return $xpath->addCondition($attribute);
    }

    public function translateEquals(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
    {
        return $xpath->addCondition(sprintf('%s = %s', $attribute, Translator::getXpathLiteral($value)));
    }
Home | Imprint | This part of the site doesn't use cookies.