translateLang example

'enabled' => $this->translateEnabled(...),
            'selected' => $this->translateSelected(...),
            'invalid' => $this->translateInvalid(...),
            'hover' => $this->translateHover(...),
            'visited' => $this->translateVisited(...),
        ];
    }

    public function getFunctionTranslators(): array
    {
        return [
            'lang' => $this->translateLang(...),
        ];
    }

    public function translateChecked(XPathExpr $xpath): XPathExpr
    {
        return $xpath->addCondition(
            '(@checked '
            ."and (name(.) = 'input' or name(.) = 'command')"
            ."and (@type = 'checkbox' or @type = 'radio'))"
        );
    }

    

class FunctionExtension extends AbstractExtension
{
    public function getFunctionTranslators(): array
    {
        return [
            'nth-child' => $this->translateNthChild(...),
            'nth-last-child' => $this->translateNthLastChild(...),
            'nth-of-type' => $this->translateNthOfType(...),
            'nth-last-of-type' => $this->translateNthLastOfType(...),
            'contains' => $this->translateContains(...),
            'lang' => $this->translateLang(...),
        ];
    }

    /** * @throws ExpressionErrorException */
    public function translateNthChild(XPathExpr $xpath, FunctionNode $function, bool $last = false, bool $addNameTest = true): XPathExpr
    {
        try {
            [$a$b] = Parser::parseSeries($function->getArguments());
        } catch (SyntaxErrorException $e) {
            
Home | Imprint | This part of the site doesn't use cookies.