AbstractFormatterSubscriber   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getFormatter() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Http Adapter package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\HttpAdapter\Event\Subscriber;
13
14
use Ivory\HttpAdapter\Event\Formatter\Formatter;
15
use Ivory\HttpAdapter\Event\Formatter\FormatterInterface;
16
use Ivory\HttpAdapter\Event\Timer\TimerInterface;
17
18
/**
19
 * @author GeLo <[email protected]>
20
 */
21
abstract class AbstractFormatterSubscriber extends AbstractTimerSubscriber
22
{
23
    /**
24
     * @var FormatterInterface
25
     */
26
    private $formatter;
27
28
    /**
29
     * @param FormatterInterface|null $formatter
30
     * @param TimerInterface|null     $timer
31
     */
32 81
    public function __construct(FormatterInterface $formatter = null, TimerInterface $timer = null)
33 7
    {
34 81
        parent::__construct($timer);
35
36 81
        $this->formatter = $formatter ?: new Formatter();
37 81
    }
38
39
    /**
40
     * @return FormatterInterface
41
     */
42 72
    public function getFormatter()
43
    {
44 72
        return $this->formatter;
45
    }
46
}
47