1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of coisa/error-handler. |
5
|
|
|
* |
6
|
|
|
* (c) Felipe Sayão Lobato Abreu <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace CoiSA\ErrorHandler\Container; |
15
|
|
|
|
16
|
|
|
use CoiSA\ErrorHandler\ErrorHandler; |
17
|
|
|
use CoiSA\ErrorHandler\Handler\DispatchErrorEventThrowableHandler; |
18
|
|
|
use CoiSA\ErrorHandler\Handler\DispatchThrowableHandler; |
19
|
|
|
use CoiSA\ErrorHandler\Handler\ThrowableHandlerAggregate; |
20
|
|
|
use CoiSA\ErrorHandler\Handler\ThrowableHandlerInterface; |
21
|
|
|
use CoiSA\ErrorHandler\Http\Message\ThrowableResponseFactory; |
22
|
|
|
use CoiSA\ErrorHandler\Http\Message\ThrowableResponseFactoryInterface; |
23
|
|
|
use CoiSA\ErrorHandler\Http\Message\ThrowableStreamFactory; |
24
|
|
|
use CoiSA\ErrorHandler\Http\Message\ThrowableStreamFactoryInterface; |
25
|
|
|
use CoiSA\ErrorHandler\Http\Middleware\ErrorHandlerMiddleware; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Class ConfigProvider |
29
|
|
|
* |
30
|
|
|
* @package CoiSA\ErrorHandler\Container |
31
|
|
|
*/ |
32
|
|
|
final class ConfigProvider |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* @return array |
36
|
|
|
*/ |
37
|
60 |
|
public function __invoke(): array |
38
|
|
|
{ |
39
|
|
|
return [ |
40
|
60 |
|
'dependencies' => $this->getDependencies(), |
41
|
|
|
]; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return array |
46
|
|
|
*/ |
47
|
60 |
|
public function getDependencies(): array |
48
|
|
|
{ |
49
|
|
|
return [ |
50
|
60 |
|
'aliases' => $this->getAliases(), |
51
|
60 |
|
'factories' => $this->getFactories(), |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return array |
57
|
|
|
*/ |
58
|
82 |
|
public function getAliases(): array |
59
|
|
|
{ |
60
|
|
|
return [ |
61
|
82 |
|
ThrowableHandlerInterface::class => ThrowableHandlerAggregate::class, |
62
|
|
|
ThrowableResponseFactoryInterface::class => ThrowableResponseFactory::class, |
63
|
|
|
ThrowableStreamFactoryInterface::class => ThrowableStreamFactory::class, |
64
|
|
|
]; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return array |
69
|
|
|
*/ |
70
|
82 |
|
public function getFactories(): array |
71
|
|
|
{ |
72
|
|
|
return [ |
73
|
82 |
|
ErrorHandler::class => Factory\ErrorHandlerFactory::class, |
74
|
|
|
ErrorHandlerMiddleware::class => Factory\ErrorHandlerMiddlewareFactory::class, |
75
|
|
|
DispatchErrorEventThrowableHandler::class => Factory\DispatchErrorEventThrowableHandlerFactory::class, |
76
|
|
|
DispatchThrowableHandler::class => Factory\DispatchThrowableHandlerFactory::class, |
77
|
|
|
ThrowableHandlerAggregate::class => Factory\ThrowableHandlerAggregateFactory::class, |
78
|
|
|
ThrowableResponseFactory::class => Factory\ThrowableResponseFactoryFactory::class, |
79
|
|
|
ThrowableStreamFactory::class => Factory\ThrowableStreamFactoryFactory::class, |
80
|
|
|
]; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|