Passed
Push — master ( f8e3f7...025a78 )
by Sebastian
03:51
created

Microtime_ParseResult::getDateTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * File containing the class {@see \AppUtils\Microtime_ParseResult}.
4
 *
5
 * @package Application Utils
6
 * @subpackage Microtime
7
 * @see \AppUtils\Microtime_ParseResult
8
 */
9
10
declare(strict_types=1);
11
12
namespace AppUtils;
13
14
use DateTimeZone;
15
16
/**
17
 * Date parsing result, containing the date string
18
 * and time zone to use for the DateTime constructor.
19
 *
20
 * This is used to simplify creating a new microtime
21
 * instance when using the factory methods, to avoid
22
 * the type checks that are done when using the
23
 * constructor.
24
 *
25
 * @package Application Utils
26
 * @subpackage Microtime
27
 * @author Sebastian Mordziol <[email protected]>
28
 */
29
class Microtime_ParseResult
30
{
31
    /**
32
     * @var string
33
     */
34
    private $dateTime;
35
36
    /**
37
     * @var DateTimeZone
38
     */
39
    private $timeZone;
40
41
    public function __construct(string $datetime, DateTimeZone $timeZone)
42
    {
43
        $this->dateTime = $datetime;
44
        $this->timeZone = $timeZone;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getDateTime() : string
51
    {
52
        return $this->dateTime;
53
    }
54
55
    /**
56
     * @return DateTimeZone
57
     */
58
    public function getTimeZone() : DateTimeZone
59
    {
60
        return $this->timeZone;
61
    }
62
}
63