Пример #1
0
 public static function create(callable $handler = null) : self
 {
     $stack = new self($handler ?: choose_handler());
     $stack->push(Middleware::httpErrors());
     $stack->push(Middleware::prepareBody());
     return $stack;
 }
Пример #2
0
 public function test_auth_handler_is_returned()
 {
     $generator = function () {
     };
     $middleware = Middleware::authHandler($generator);
     $handler = new MockHandler([new Response(204)]);
     $fn = $middleware($handler);
     $this->assertInstanceOf(AuthHandler::class, $fn);
 }
Пример #3
0
 private function getStack(callable $authHandler, Token $token = null) : HandlerStack
 {
     $stack = HandlerStack::create();
     $stack->push(Middleware::authHandler($authHandler, $token));
     return $stack;
 }