1 | <?php |
||
8 | class Date { |
||
9 | |||
10 | public $year = '00'; |
||
11 | public $month = '00'; |
||
12 | public $day = '00'; |
||
13 | public $hour = '00'; |
||
14 | public $minute = '00'; |
||
15 | public $second = '00'; |
||
16 | static $monthNames = [0 => "00", "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; |
||
17 | |||
18 | /** @var int */ |
||
19 | public static $units = [ |
||
20 | 'seconds' => 1, |
||
21 | 'minutes' => 60, |
||
22 | 'hours' => 60 * 60, |
||
23 | 'days' => 60 * 60 * 24, |
||
24 | 'weeks' => 60 * 60 * 24 * 7, |
||
25 | 'months' => 60 * 60 * 24 * 30, |
||
26 | 'years' => 60 * 60 * 24 * 365 |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * Inicia a data/hora de acordo com a string informada |
||
31 | * @param string |
||
32 | * @example new Data('01/01/1980 18:00'); |
||
33 | */ |
||
34 | public function __construct($stringDate = null) { |
||
37 | |||
38 | /* METODOS DE ACESSO */ |
||
39 | |||
40 | public function isEmpty() { |
||
43 | |||
44 | public function getMonthName() { |
||
47 | |||
48 | public function getMonthAbbre() { |
||
51 | |||
52 | /** |
||
53 | * Inicia o objeto de acordo com a data informada |
||
54 | * @param string $stringDate |
||
55 | */ |
||
56 | public function initDateTime($stringDate = null) { |
||
64 | |||
65 | /** |
||
66 | * Inicia o Dia/Mes/Ano |
||
67 | * @param string $stringDateOnly |
||
68 | */ |
||
69 | private function initDate($stringDateOnly) { |
||
82 | |||
83 | /** |
||
84 | * Inicia a Hora:Minuto:Segundo |
||
85 | * @param string $stringTimeOnly |
||
86 | */ |
||
87 | private function initTime($stringTimeOnly) { |
||
94 | |||
95 | /** |
||
96 | * Retorna a data no padrao HTML BRASILEIRO: "Dia/Mês/Ano Hora:Minuto:Segundo" |
||
97 | * @return string |
||
98 | */ |
||
99 | public function toHtml() { |
||
102 | |||
103 | /** |
||
104 | * Retorna a data com o formato padrão 'd/m/y' |
||
105 | * @return string |
||
106 | */ |
||
107 | public function __toString() { |
||
110 | |||
111 | /** |
||
112 | * Retorna a data no padrao SQL DATETIME |
||
113 | * @return string |
||
114 | */ |
||
115 | public function toSql() { |
||
118 | |||
119 | /** |
||
120 | * Retorna a data no padrao TimeAgo |
||
121 | * @return string |
||
122 | */ |
||
123 | public function toTimeAgo() { |
||
126 | |||
127 | /** |
||
128 | * Retorna a data de acordo com o formato escolhido. Ex: [d/m/y h:i:s] , [y-m-d] , [y-m-d h:i:s] , etc |
||
129 | * @param string $format |
||
130 | * @return string Data no formato desejado |
||
131 | */ |
||
132 | public function format($format = 'd/m/y') { |
||
141 | |||
142 | /** |
||
143 | * Valida a data |
||
144 | * @return boolean retorna True se data é valida |
||
145 | */ |
||
146 | public function isValid() { |
||
152 | |||
153 | /** |
||
154 | * Retorna true se é uma data de nascimento válida |
||
155 | * @return boolean |
||
156 | */ |
||
157 | public function isValidBirthday() { |
||
166 | |||
167 | /** |
||
168 | * Soma a quantidade de tempo informada |
||
169 | * @param int $time |
||
170 | * @param string $unit [days,month,years,etc] |
||
171 | */ |
||
172 | public function sumTime($time, $unit = 'days') { |
||
176 | |||
177 | /** |
||
178 | * Retorna o mktime da data |
||
179 | * @return int |
||
180 | */ |
||
181 | public function toMktime() { |
||
184 | |||
185 | /** |
||
186 | * Retorna a diferença em Segundos entre as duas datas |
||
187 | * @param Date $date |
||
188 | * @param string $unit [days,month,years,etc] |
||
189 | * @return int diferença na unidade desejada |
||
190 | */ |
||
191 | public function diff(Date $date, $unit = 'seconds') { |
||
195 | |||
196 | /** |
||
197 | * Converte segundos em outra unidade |
||
198 | * @param int $seconds |
||
199 | * @param string $newUnit [days,month,years,etc] |
||
200 | */ |
||
201 | public static function convertSeconds($seconds = 0, $newUnit = 'minutes') { |
||
204 | |||
205 | } |
||
206 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.