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
|
|
|
} |