You are here

private function HandlerStack::splice in Auth0 Single Sign On 8.2

Splices a function into the middleware list at a specific position.

Parameters

string $findName:

string $withName:

callable $middleware:

bool $before:

2 calls to HandlerStack::splice()
HandlerStack::after in vendor/guzzlehttp/guzzle/src/HandlerStack.php
Add a middleware after another middleware by name.
HandlerStack::before in vendor/guzzlehttp/guzzle/src/HandlerStack.php
Add a middleware before another middleware by name.

File

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

Class

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

Namespace

GuzzleHttp

Code

private function splice($findName, $withName, callable $middleware, $before) {
  $this->cached = null;
  $idx = $this
    ->findByName($findName);
  $tuple = [
    $middleware,
    $withName,
  ];
  if ($before) {
    if ($idx === 0) {
      array_unshift($this->stack, $tuple);
    }
    else {
      $replacement = [
        $tuple,
        $this->stack[$idx],
      ];
      array_splice($this->stack, $idx, 1, $replacement);
    }
  }
  elseif ($idx === count($this->stack) - 1) {
    $this->stack[] = $tuple;
  }
  else {
    $replacement = [
      $this->stack[$idx],
      $tuple,
    ];
    array_splice($this->stack, $idx, 1, $replacement);
  }
}