Completed
Push — master ( 6551be...435af8 )
by Mario
09:41
created

DateTime::getGetParameterName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marek\OpenWeatherMap\API\Value\Parameter\Input;
6
7
use Marek\OpenWeatherMap\API\Value\Parameter\GetParameterInterface;
8
use Marek\OpenWeatherMap\API\Value\Parameter\UriParameterInterface;
9
10
class DateTime implements GetParameterInterface, UriParameterInterface
11
{
12
    /**
13
     * @var \DateTimeInterface
14
     */
15
    protected $datetime;
16
17
    /**
18
     * Datetime constructor.
19
     *
20
     * @param \DateTimeInterface $datetime
21
     */
22
    public function __construct(\DateTimeInterface $datetime)
23
    {
24
        $this->datetime = $datetime;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getDateTime()
31
    {
32
        return $this->datetime;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getGetParameterValue()
39
    {
40
        return $this->datetime->getTimestamp();
41
    }
42
43
    public function getGetParameterName()
44
    {
45
        throw new \RuntimeException('Not implemented.');
46
    }
47
48
    public function getUriParameterValue()
49
    {
50
        return $this->datetime->format('Y-m-d\TH:i:s\Z');
51
    }
52
53
    public function getUriParameterName()
54
    {
55
        return 'datetime';
56
    }
57
58
59
}
60