ErrorCatcherDecoratorFactory::decorate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Dock\Installer\System\Catcher;
4
5
use Dock\IO\UserInteraction;
6
use SRIO\ChainOfResponsibility\ChainProcessInterface;
7
use SRIO\ChainOfResponsibility\DecoratorFactoryInterface;
8
9
class ErrorCatcherDecoratorFactory implements DecoratorFactoryInterface
10
{
11
    /**
12
     * @var DecoratorFactoryInterface
13
     */
14
    private $decoratedFactory;
15
    /**
16
     * @var UserInteraction
17
     */
18
    private $userInteraction;
19
20
    /**
21
     * @param DecoratorFactoryInterface $decoratedFactory
22
     * @param UserInteraction           $userInteraction
23
     */
24
    public function __construct(DecoratorFactoryInterface $decoratedFactory, UserInteraction $userInteraction)
25
    {
26
        $this->decoratedFactory = $decoratedFactory;
27
        $this->userInteraction = $userInteraction;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function decorate(ChainProcessInterface $process, ChainProcessInterface $next = null)
34
    {
35
        return new XcodeLicenseErrorCatcherDecorator(
36
            $this->userInteraction,
37
            $this->decoratedFactory->decorate($process, $next)
38
        );
39
    }
40
}
41