AbstractFormatterSubscriber::getFormatter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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