You are here

public function HandlerStack::__toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/HandlerStack.php \GuzzleHttp\HandlerStack::__toString()

Dumps a string representation of the stack.

Return value

string

File

vendor/guzzlehttp/guzzle/src/HandlerStack.php, line 78

Class

HandlerStack
Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.

Namespace

GuzzleHttp

Code

public function __toString() {
  $depth = 0;
  $stack = [];
  if ($this->handler) {
    $stack[] = "0) Handler: " . $this
      ->debugCallable($this->handler);
  }
  $result = '';
  foreach (array_reverse($this->stack) as $tuple) {
    $depth++;
    $str = "{$depth}) Name: '{$tuple[1]}', ";
    $str .= "Function: " . $this
      ->debugCallable($tuple[0]);
    $result = "> {$str}\n{$result}";
    $stack[] = $str;
  }
  foreach (array_keys($stack) as $k) {
    $result .= "< {$stack[$k]}\n";
  }
  return $result;
}