Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. StreamHandler.php

function StreamHandler::add_debug

Parameters

mixed $value as passed via Request transfer options.:

File

vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php, line 566

Class

StreamHandler
HTTP handler that uses PHP's HTTP stream wrapper.

Namespace

GuzzleHttp\Handler

Code

private function add_debug(RequestInterface $request, array &$options, $value, array &$params) : void {
    if ($value === false) {
        return;
    }
    static $map = [
        \STREAM_NOTIFY_CONNECT => 'CONNECT',
        \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED',
        \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT',
        \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS',
        \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS',
        \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED',
        \STREAM_NOTIFY_PROGRESS => 'PROGRESS',
        \STREAM_NOTIFY_FAILURE => 'FAILURE',
        \STREAM_NOTIFY_COMPLETED => 'COMPLETED',
        \STREAM_NOTIFY_RESOLVE => 'RESOLVE',
    ];
    static $args = [
        'severity',
        'message',
        'message_code',
        'bytes_transferred',
        'bytes_max',
    ];
    $value = Utils::debugResource($value);
    $ident = $request->getMethod() . ' ' . $request->getUri()
        ->withFragment('');
    self::addNotification($params, static function (int $code, ...$passed) use ($ident, $value, $map, $args) : void {
        \fprintf($value, '<%s> [%s] ', $ident, $map[$code]);
        foreach (\array_filter($passed) as $i => $v) {
            \fwrite($value, $args[$i] . ': "' . $v . '" ');
        }
        \fwrite($value, "\n");
    });
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal