Passed
Branch master (7f48e0)
by Felipe
06:05
created

ConfigProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 16
c 1
b 0
f 0
dl 0
loc 38
ccs 5
cts 9
cp 0.5556
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A getDependencies() 0 4 1
A getFactories() 0 13 1
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\Container\Factory\AliasFactory;
17
use CoiSA\ErrorHandler\ErrorHandler;
18
use CoiSA\ErrorHandler\Handler\DispatchErrorEventThrowableHandler;
19
use CoiSA\ErrorHandler\Handler\DispatchThrowableHandler;
20
use CoiSA\ErrorHandler\Handler\ThrowableHandlerAggregate;
21
use CoiSA\ErrorHandler\Handler\ThrowableHandlerInterface;
22
use CoiSA\ErrorHandler\Http\Message\ThrowableResponseFactory;
23
use CoiSA\ErrorHandler\Http\Message\ThrowableResponseFactoryInterface;
24
use CoiSA\ErrorHandler\Http\Message\ThrowableStreamFactory;
25
use CoiSA\ErrorHandler\Http\Message\ThrowableStreamFactoryInterface;
26
use CoiSA\ErrorHandler\Http\Middleware\ErrorHandlerMiddleware;
27
28
/**
29
 * Class ConfigProvider
30
 *
31
 * @package CoiSA\ErrorHandler\Container
32
 */
33
final class ConfigProvider
34
{
35
    /**
36
     * @return array
37
     */
38
    public function __invoke(): array
39
    {
40
        return [
41
            'dependencies' => $this->getDependencies(),
42
        ];
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    public function getDependencies(): array
49
    {
50
        return [
51
            'factories' => $this->getFactories(),
52
        ];
53
    }
54
55
    /**
56
     * @return array
57
     */
58 28
    public function getFactories(): array
59
    {
60
        return [
61 28
            ErrorHandler::class                       => Factory\ErrorHandlerFactory::class,
62
            ErrorHandlerMiddleware::class             => Factory\ErrorHandlerMiddlewareFactory::class,
63
            DispatchErrorEventThrowableHandler::class => Factory\DispatchErrorEventThrowableHandlerFactory::class,
64
            DispatchThrowableHandler::class           => Factory\DispatchThrowableHandlerFactory::class,
65
            ThrowableHandlerAggregate::class          => Factory\ThrowableHandlerAggregateFactory::class,
66 28
            ThrowableHandlerInterface::class          => new AliasFactory(ThrowableHandlerAggregate::class),
67
            ThrowableResponseFactory::class           => Factory\ThrowableResponseFactoryFactory::class,
68 28
            ThrowableResponseFactoryInterface::class  => new AliasFactory(ThrowableResponseFactory::class),
69
            ThrowableStreamFactory::class             => Factory\ThrowableStreamFactoryFactory::class,
70 28
            ThrowableStreamFactoryInterface::class    => new AliasFactory(ThrowableStreamFactory::class),
71
        ];
72
    }
73
}
74