-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
ConfigProvider.php
77 lines (70 loc) · 4.05 KB
/
ConfigProvider.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* @see https://github.com/mezzio/mezzio for the canonical source repository
* @copyright https://github.com/mezzio/mezzio/blob/master/COPYRIGHT.md
* @license https://github.com/mezzio/mezzio/blob/master/LICENSE.md New BSD License
*/
declare(strict_types=1);
namespace Mezzio;
use Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
use Laminas\HttpHandlerRunner\RequestHandlerRunner;
use Laminas\Stratigility\Middleware\ErrorHandler;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamInterface;
/**
* Provide initial configuration for mezzio.
*
* This class provides initial _production_ configuration for mezzio.
*/
class ConfigProvider
{
public function __invoke() : array
{
return [
'dependencies' => $this->getDependencies(),
];
}
public function getDependencies() : array
{
// @codingStandardsIgnoreStart
return [
'aliases' => [
DEFAULT_DELEGATE => Handler\NotFoundHandler::class,
DISPATCH_MIDDLEWARE => Router\Middleware\DispatchMiddleware::class,
IMPLICIT_HEAD_MIDDLEWARE => Router\Middleware\ImplicitHeadMiddleware::class,
IMPLICIT_OPTIONS_MIDDLEWARE => Router\Middleware\ImplicitOptionsMiddleware::class,
NOT_FOUND_MIDDLEWARE => Handler\NotFoundHandler::class,
ROUTE_MIDDLEWARE => Router\Middleware\RouteMiddleware::class,
// Legacy Zend Framework aliases
\Zend\Expressive\Application::class => Application::class,
\Zend\Expressive\ApplicationPipeline::class => ApplicationPipeline::class,
\Zend\HttpHandlerRunner\Emitter\EmitterInterface::class => EmitterInterface::class,
\Zend\Stratigility\Middleware\ErrorHandler::class => ErrorHandler::class,
\Zend\Expressive\Handler\NotFoundHandler::class => Handler\NotFoundHandler::class,
\Zend\Expressive\MiddlewareContainer::class => MiddlewareContainer::class,
\Zend\Expressive\MiddlewareFactory::class => MiddlewareFactory::class,
\Zend\Expressive\Middleware\ErrorResponseGenerator::class => Middleware\ErrorResponseGenerator::class,
\Zend\HttpHandlerRunner\RequestHandlerRunner::class => RequestHandlerRunner::class,
\Zend\Expressive\Response\ServerRequestErrorResponseGenerator::class => Response\ServerRequestErrorResponseGenerator::class,
],
'factories' => [
Application::class => Container\ApplicationFactory::class,
ApplicationPipeline::class => Container\ApplicationPipelineFactory::class,
EmitterInterface::class => Container\EmitterFactory::class,
ErrorHandler::class => Container\ErrorHandlerFactory::class,
Handler\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
MiddlewareContainer::class => Container\MiddlewareContainerFactory::class,
MiddlewareFactory::class => Container\MiddlewareFactoryFactory::class,
// Change the following in development to the WhoopsErrorResponseGeneratorFactory:
Middleware\ErrorResponseGenerator::class => Container\ErrorResponseGeneratorFactory::class,
RequestHandlerRunner::class => Container\RequestHandlerRunnerFactory::class,
ResponseInterface::class => Container\ResponseFactoryFactory::class,
Response\ServerRequestErrorResponseGenerator::class => Container\ServerRequestErrorResponseGeneratorFactory::class,
ServerRequestInterface::class => Container\ServerRequestFactoryFactory::class,
StreamInterface::class => Container\StreamFactoryFactory::class,
],
];
// @codingStandardsIgnoreEnd
}
}