translateNthLastOfType example


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 {
            [
Home | Imprint | This part of the site doesn't use cookies.