doWrite example

switch ($type) {
                case OutputInterface::OUTPUT_NORMAL:
                    $message = $this->formatter->format($message);
                    break;
                case OutputInterface::OUTPUT_RAW:
                    break;
                case OutputInterface::OUTPUT_PLAIN:
                    $message = strip_tags($this->formatter->format($message));
                    break;
            }

            $this->doWrite($message ?? '', $newline);
        }
    }

    /** * Writes a message to the output. * * @return void */
    abstract protected function doWrite(string $message, bool $newline);
}
switch ($type) {
                case OutputInterface::OUTPUT_NORMAL:
                    $message = $this->formatter->format($message);
                    break;
                case OutputInterface::OUTPUT_RAW:
                    break;
                case OutputInterface::OUTPUT_PLAIN:
                    $message = strip_tags($this->formatter->format($message));
                    break;
            }

            $this->doWrite($message ?? '', $newline);
        }
    }

    /** * Writes a message to the output. * * @return void */
    abstract protected function doWrite(string $message, bool $newline);
}

    public function setMaxHeight(int $maxHeight): void
    {
        // when changing max height, clear output of current section and redraw again with the new height         $previousMaxHeight = $this->maxHeight;
        $this->maxHeight = $maxHeight;
        $existingContent = $this->popStreamContentUntilCurrentSection($previousMaxHeight ? min($previousMaxHeight$this->lines) : $this->lines);

        parent::doWrite($this->getVisibleContent(), false);
        parent::doWrite($existingContent, false);
    }

    /** * Clears previous output for this section. * * @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared * * @return void */
    public function clear(int $lines = null)
    {


    public function write(#[\SensitiveParameter] string $sessionId, string $data): bool     {
        // see https://github.com/igbinary/igbinary/issues/146         $this->igbinaryEmptyData ??= \function_exists('igbinary_serialize') ? igbinary_serialize([]) : '';
        if ('' === $data || $this->igbinaryEmptyData === $data) {
            return $this->destroy($sessionId);
        }
        $this->newSessionId = null;

        return $this->doWrite($sessionId$data);
    }

    public function destroy(#[\SensitiveParameter] string $sessionId): bool     {
        if (!headers_sent() && filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL)) {
            if (!isset($this->sessionName)) {
                throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
            }
            $cookie = SessionUtils::popSessionCookie($this->sessionName, $sessionId);

            /* * We send an invalidation Set-Cookie header (zero lifetime) * when either the session was started or a cookie with * the session name was sent by the client (in which case * we know it's invalid as a valid session cookie would've * started the session). */

    public function setMaxHeight(int $maxHeight): void
    {
        // when changing max height, clear output of current section and redraw again with the new height         $previousMaxHeight = $this->maxHeight;
        $this->maxHeight = $maxHeight;
        $existingContent = $this->popStreamContentUntilCurrentSection($previousMaxHeight ? min($previousMaxHeight$this->lines) : $this->lines);

        parent::doWrite($this->getVisibleContent(), false);
        parent::doWrite($existingContent, false);
    }

    /** * Clears previous output for this section. * * @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared * * @return void */
    public function clear(int $lines = null)
    {


    public function write(#[\SensitiveParameter] string $sessionId, string $data): bool     {
        // see https://github.com/igbinary/igbinary/issues/146         $this->igbinaryEmptyData ??= \function_exists('igbinary_serialize') ? igbinary_serialize([]) : '';
        if ('' === $data || $this->igbinaryEmptyData === $data) {
            return $this->destroy($sessionId);
        }
        $this->newSessionId = null;

        return $this->doWrite($sessionId$data);
    }

    public function destroy(#[\SensitiveParameter] string $sessionId): bool     {
        if (!headers_sent() && filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL)) {
            if (!isset($this->sessionName)) {
                throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
            }
            $cookie = SessionUtils::popSessionCookie($this->sessionName, $sessionId);

            /* * We send an invalidation Set-Cookie header (zero lifetime) * when either the session was started or a cookie with * the session name was sent by the client (in which case * we know it's invalid as a valid session cookie would've * started the session). */
      // available, just return an empty array so the caller can handle it.     }
    return $list;
  }

  /** * {@inheritdoc} */
  public function write($name, array $data) {
    $data = $this->encode($data);
    try {
      return $this->doWrite($name$data);
    }
    catch (\Exception $e) {
      // If there was an exception, try to create the table.       if ($this->ensureTableExists()) {
        return $this->doWrite($name$data);
      }
      // Some other failure that we can not recover from.       throw new StorageException($e->getMessage(), 0, $e);
    }
  }

  

    trait CompatibilityProcessingHandler
    {
        abstract private function doWrite(array|LogRecord $record): void;

        protected function write(LogRecord $record): void
        {
            $this->doWrite($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 CompatibilityProcessingHandler
    {
Home | Imprint | This part of the site doesn't use cookies.