Converter::getDateTime()   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 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2016, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Bundle\DateBundle\TimeZone;
11
12
use GpsLab\Bundle\DateBundle\Converter as DateConverter;
13
use GpsLab\Bundle\DateBundle\TimeZone\Keeper\KeeperInterface;
14
15
class Converter extends DateConverter
16
{
17
    /**
18
     * @var KeeperInterface
19
     */
20
    private $keeper;
21
22
    /**
23
     * @param KeeperInterface $keeper
24
     */
25 4
    public function __construct(KeeperInterface $keeper)
26
    {
27 4
        $this->keeper = $keeper;
28 4
    }
29
30
    /**
31
     * @param mixed $date
32
     *
33
     * @return \DateTime
34
     */
35 4
    public function getDateTime($date)
36
    {
37 4
        return parent::getDateTime($date)->setTimezone($this->keeper->getUserTimeZone());
38
    }
39
}
40