Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
LogicFactory | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
createLogic | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\Core\Mvc; |
6 | |
7 | use PeServer\Core\DI\DiFactoryBase; |
8 | use PeServer\Core\DI\DiFactoryTrait; |
9 | use PeServer\Core\DI\IDiContainer; |
10 | use PeServer\Core\Log\ILogger; |
11 | use PeServer\Core\Log\LoggerFactory; |
12 | use PeServer\Core\Mvc\LogicParameter; |
13 | |
14 | class LogicFactory extends DiFactoryBase implements ILogicFactory |
15 | { |
16 | use DiFactoryTrait; |
17 | |
18 | #region ILogicFactory |
19 | |
20 | public function createLogic(string $logicClassName, array $arguments = []): LogicBase |
21 | { |
22 | $logger = $this->container->new(LoggerFactory::class)->createLogger($logicClassName); |
23 | $parameter = $this->container->new(LogicParameter::class, [ILogger::class => $logger]); |
24 | $arguments[LogicParameter::class] = $parameter; |
25 | return $this->container->new($logicClassName, $arguments); |
26 | } |
27 | |
28 | #endregion |
29 | } |