doHandle example


    trait CompatibilityHandler
    {
        abstract private function doHandle(array|LogRecord $record): bool;

        public function handle(LogRecord $record): bool
        {
            return $this->doHandle($record);
        }
    }
} else {
    /** * The base class for compatibility between Monolog 3 LogRecord and Monolog 1/2 array records. * * @author Jordi Boggiano <j.boggiano@seld.be> * * @internal */
    trait CompatibilityHandler
    {
public function __construct(
        protected string $environment,
        protected bool $debug,
        protected ?ClassLoader $classLoader = null
    ) {
    }

    public function handle(Request $request, int $type = HttpKernelInterface::MAIN_REQUEST, bool $catch = true): HttpKernelResult
    {
        try {
            return $this->doHandle($request$type$catch);
        } catch (Exception $e) {
            /** @var Params|array{url?: string} $connectionParams */
            $connectionParams = self::getConnection()->getParams();

            $message = str_replace([$connectionParams['url'] ?? null, $connectionParams['password'] ?? null, $connectionParams['user'] ?? null], '******', $e->getMessage());

            throw new \RuntimeException(sprintf('Could not connect to database. Message from SQL Server: %s', $message));
        }
    }

    public function getKernel(): KernelInterface
    {
Home | Imprint | This part of the site doesn't use cookies.