ExceptionHandlerBusinessFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 38
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createExceptionRegistrar() 0 5 1
A getExceptionRegisterCollection() 0 3 1
A getExceptionHandlerCollection() 0 3 1
A createExceptionHandler() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\ExceptionHandler\Business;
5
6
7
use Xervice\Core\Business\Model\Factory\AbstractBusinessFactory;
8
use Xervice\ExceptionHandler\Business\Model\Handler\HandlerCollection;
9
use Xervice\ExceptionHandler\Business\Model\Handler\HandlerProvider;
10
use Xervice\ExceptionHandler\Business\Model\Handler\HandlerProviderInterface;
11
use Xervice\ExceptionHandler\Business\Model\Register\ExceptionRegistrar;
12
use Xervice\ExceptionHandler\Business\Model\Register\ExceptionRegistrarInterface;
13
use Xervice\ExceptionHandler\Business\Model\Register\RegisterCollection;
14
use Xervice\ExceptionHandler\ExceptionHandlerDependencyProvider;
15
16
/**
17
 * @method \Xervice\ExceptionHandler\ExceptionHandlerConfig getConfig()
18
 */
19
class ExceptionHandlerBusinessFactory extends AbstractBusinessFactory
20
{
21
    /**
22
     * @return \Xervice\ExceptionHandler\Business\Model\Handler\HandlerProviderInterface
23
     */
24 1
    public function createExceptionHandler(): HandlerProviderInterface
25
    {
26 1
        return new HandlerProvider(
27 1
            $this->getExceptionHandlerCollection(),
28 1
            $this->getConfig()->isDebug()
29
        );
30
    }
31
32
    /**
33
     * @return \Xervice\ExceptionHandler\Business\Model\Register\ExceptionRegistrarInterface
34
     */
35 1
    public function createExceptionRegistrar(): ExceptionRegistrarInterface
36
    {
37 1
        return new ExceptionRegistrar(
38 1
            $this->getExceptionRegisterCollection(),
39 1
            $this->getConfig()->isDebug()
40
        );
41
    }
42
43
    /**
44
     * @return \Xervice\ExceptionHandler\Business\Model\Handler\HandlerCollection
45
     */
46 1
    public function getExceptionHandlerCollection(): HandlerCollection
47
    {
48 1
        return $this->getDependency(ExceptionHandlerDependencyProvider::EXCEPTION_HANDLER);
49
    }
50
51
    /**
52
     * @return \Xervice\ExceptionHandler\Business\Model\Register\RegisterCollection
53
     */
54 1
    public function getExceptionRegisterCollection(): RegisterCollection
55
    {
56 1
        return $this->getDependency(ExceptionHandlerDependencyProvider::EXCEPTION_REGISTER);
57
    }
58
}