This repository was archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathRequestHandlerRunnerFactory.php
47 lines (43 loc) · 1.74 KB
/
RequestHandlerRunnerFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @see https://github.com/zendframework/zend-expressive for the canonical source repository
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-expressive/blob/master/LICENSE.md New BSD License
*/
declare(strict_types=1);
namespace Zend\Expressive\Container;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Expressive\ApplicationPipeline;
use Zend\Expressive\Response\ServerRequestErrorResponseGenerator;
use Zend\HttpHandlerRunner\Emitter\EmitterInterface;
use Zend\HttpHandlerRunner\RequestHandlerRunner;
/**
* Create an ApplicationRunner instance.
*
* This class consumes two pseudo-services (services that look like class
* names, but resolve to other artifacts) and two services provided within
* this package:
*
* - Zend\Expressive\ApplicationPipeline, which should resolve to a
* Zend\Stratigility\MiddlewarePipeInterface and/or
* Psr\Http\Server\RequestHandlerInterface instance.
* - Zend\HttpHandlerRunner\Emitter\EmitterInterface.
* - Psr\Http\Message\ServerRequestInterface, which should resolve to a PHP
* callable that will return a Psr\Http\Message\ServerRequestInterface
* instance.
* - Zend\Expressive\Response\ServerRequestErrorResponseGeneratorFactory,
*
*/
class RequestHandlerRunnerFactory
{
public function __invoke(ContainerInterface $container) : RequestHandlerRunner
{
return new RequestHandlerRunner(
$container->get(ApplicationPipeline::class),
$container->get(EmitterInterface::class),
$container->get(ServerRequestInterface::class),
$container->get(ServerRequestErrorResponseGenerator::class)
);
}
}