setDateFormat example

$this->timezone = $timezone;
        $this->decimals = $decimals;
        $this->decimalPoint = $decimalPoint;
        $this->thousandsSeparator = $thousandsSeparator;
    }

    /** * @return void */
    public function configure(Environment $environment)
    {
        $environment->getExtension(CoreExtension::class)->setDateFormat($this->dateFormat, $this->intervalFormat);

        if (null !== $this->timezone) {
            $environment->getExtension(CoreExtension::class)->setTimezone($this->timezone);
        }

        $environment->getExtension(CoreExtension::class)->setNumberFormat($this->decimals, $this->decimalPoint, $this->thousandsSeparator);

        // wrap UndefinedCallableHandler in closures for lazy-autoloading         $environment->registerUndefinedFilterCallback(fn ($name) => UndefinedCallableHandler::onUndefinedFilter($name));
        $environment->registerUndefinedFunctionCallback(fn ($name) => UndefinedCallableHandler::onUndefinedFunction($name));
    }
}
continue;
            }
            $this->twig->addExtension($extension);
        }
        if ($this->twig->hasExtension(CoreExtension::class) && $this->platformTwig->hasExtension(CoreExtension::class)) {
            /** @var CoreExtension $coreExtensionInternal */
            $coreExtensionInternal = $this->twig->getExtension(CoreExtension::class);
            /** @var CoreExtension $coreExtensionGlobal */
            $coreExtensionGlobal = $this->platformTwig->getExtension(CoreExtension::class);

            $coreExtensionInternal->setTimezone($coreExtensionGlobal->getTimezone());
            $coreExtensionInternal->setDateFormat(...$coreExtensionGlobal->getDateFormat());
            $coreExtensionInternal->setNumberFormat(...$coreExtensionGlobal->getNumberFormat());
        }
    }

    /** * @param array<string, mixed> $data * * @throws StringTemplateRenderingException */
    public function render(string $templateSource, array $data, Context $context, bool $htmlEscape = true): string
    {
        
/** * @var HandlerInterface $handler */
            $handler = $this->handlers[$className];

            if ($handler->canHandle($level)) {
                continue;
            }

            // If the handler returns false, then we             // don't execute any other handlers.             if ($handler->setDateFormat($this->dateFormat)->handle($level$message)) {
                break;
            }
        }

        return true;
    }

    /** * Replaces any placeholders in the message with variables * from the context, as well as a few special items like: * * {session_vars} * {post_vars} * {get_vars} * {env} * {env:foo} * {file} * {line} * * @param string $message * * @return string */
Home | Imprint | This part of the site doesn't use cookies.