1 | <?php |
||
17 | class DateConverter |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $dateFormat; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $timezone; |
||
29 | |||
30 | /** |
||
31 | * Constructor |
||
32 | * |
||
33 | * @param string $dateFormat date format |
||
34 | * @param string $timezone timezone |
||
35 | */ |
||
36 | public function __construct($dateFormat, $timezone) |
||
41 | |||
42 | /** |
||
43 | * get DateFormat |
||
44 | * |
||
45 | * @return string DateFormat |
||
46 | */ |
||
47 | public function getDateFormat() |
||
51 | |||
52 | /** |
||
53 | * get Timezone |
||
54 | * |
||
55 | * @return string Timezone |
||
56 | */ |
||
57 | public function getTimezone() |
||
61 | |||
62 | /** |
||
63 | * Returns a DateTime instance from a string representation |
||
64 | * |
||
65 | * @param string $data string Rfc3339 date |
||
66 | * |
||
67 | * @return \DateTime datetime |
||
|
|||
68 | */ |
||
69 | public function getDateTimeFromString($data) |
||
73 | |||
74 | /** |
||
75 | * formats a DateTime to the defined default format |
||
76 | * |
||
77 | * @param \DateTime $dateTime datetime |
||
78 | * |
||
79 | * @return string formatted date |
||
80 | */ |
||
81 | public function formatDateTime(\DateTime $dateTime) |
||
85 | |||
86 | /** |
||
87 | * accepts a Rfc3339 datetime string and converts it to the defined default format |
||
88 | * |
||
89 | * @param string $data Rfc3339 datetime |
||
90 | * |
||
91 | * @return string date in configured format |
||
92 | */ |
||
93 | public function getDateTimeStringInFormat($data) |
||
99 | } |
||
100 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.