ErrorCatcherDecoratorFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A decorate() 0 7 1
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