Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
FormattedTime | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getTime | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getDate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTimeAndDate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare( strict_types=1 ); |
4 | |
5 | namespace MediaWiki\Extension\CampaignEvents\Time; |
6 | |
7 | /** |
8 | * This is a value object that represents a formatted time, with separate getters for time, date, datetime, |
9 | * and timezone. |
10 | */ |
11 | class FormattedTime { |
12 | private string $time; |
13 | private string $date; |
14 | private string $timeAndDate; |
15 | |
16 | /** |
17 | * @param string $time |
18 | * @param string $date |
19 | * @param string $timeAndDate |
20 | */ |
21 | public function __construct( |
22 | string $time, |
23 | string $date, |
24 | string $timeAndDate |
25 | ) { |
26 | $this->time = $time; |
27 | $this->date = $date; |
28 | $this->timeAndDate = $timeAndDate; |
29 | } |
30 | |
31 | /** |
32 | * @return string |
33 | */ |
34 | public function getTime(): string { |
35 | return $this->time; |
36 | } |
37 | |
38 | /** |
39 | * @return string |
40 | */ |
41 | public function getDate(): string { |
42 | return $this->date; |
43 | } |
44 | |
45 | /** |
46 | * @return string |
47 | */ |
48 | public function getTimeAndDate(): string { |
49 | return $this->timeAndDate; |
50 | } |
51 | } |