ConfigProvider::getDependencies()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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\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 85
    public function getAliases(): array
59
    {
60
        return [
61 85
            ThrowableHandlerInterface::class         => ThrowableHandlerAggregate::class,
62
            ThrowableResponseFactoryInterface::class => ThrowableResponseFactory::class,
63
            ThrowableStreamFactoryInterface::class   => ThrowableStreamFactory::class,
64
        ];
65
    }
66
67
    /**
68
     * @return array
69
     */
70 85
    public function getFactories(): array
71
    {
72
        return [
73 85
            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