@@ -29,25 +29,25 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function amigable_time(int $from, $to = null) : string { |
31 | 31 | $intervalos = ['segundo', 'minuto', 'hora', 'día', 'semana', 'mes', 'año']; |
32 | - $duraciones = ['60','60','24','7','4.35','12']; |
|
32 | + $duraciones = ['60', '60', '24', '7', '4.35', '12']; |
|
33 | 33 | $to = $to ?? time(); |
34 | 34 | |
35 | 35 | $diferencia = $from - $to; |
36 | 36 | $tiempo = 'Dentro de'; |
37 | - if($to > $from) { |
|
37 | + if ($to > $from) { |
|
38 | 38 | $diferencia = $to - $from; |
39 | 39 | $tiempo = 'Hace'; |
40 | 40 | } |
41 | 41 | |
42 | - for($j = 0; $diferencia >= $duraciones[$j] && $j < sizeof($duraciones) - 1 ; $j++) { |
|
42 | + for ($j = 0; $diferencia >= $duraciones[$j] && $j < sizeof($duraciones) - 1; $j++) { |
|
43 | 43 | $diferencia /= $duraciones[$j]; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $diferencia = round($diferencia); |
47 | 47 | |
48 | - if($diferencia != 1) { |
|
49 | - $intervalos[5].= 'e'; //MESES |
|
50 | - $intervalos[$j].= 's'; |
|
48 | + if ($diferencia != 1) { |
|
49 | + $intervalos[5] .= 'e'; //MESES |
|
50 | + $intervalos[$j] .= 's'; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $tiempo . ' ' . $diferencia . ' ' . $intervalos[$j]; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * |
121 | 121 | */ |
122 | 122 | public static function date_difference(string $ini, string $fin) : int { |
123 | - $ini_i = explode('-',str_replace('/','-',$ini)); |
|
124 | - $fin_i = explode('-',str_replace('/','-',$fin)); |
|
125 | - return (int) floor((mktime(0, 0, 0, $fin_i[1], $fin_i[0], $fin_i[2]) - mktime(0, 0, 0, $ini_i[1], $ini_i[0], $ini_i[2])) / 86400); |
|
123 | + $ini_i = explode('-', str_replace('/', '-', $ini)); |
|
124 | + $fin_i = explode('-', str_replace('/', '-', $fin)); |
|
125 | + return (int) floor((mktime(0, 0, 0, $fin_i[1], $fin_i[0], $fin_i[2]) - mktime(0, 0, 0, $ini_i[1], $ini_i[0], $ini_i[2]))/86400); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * |
146 | 146 | */ |
147 | 147 | public static function days_of_month() : int { |
148 | - return cal_days_in_month(CAL_GREGORIAN, (int) date('m',time()), (int) date('Y',time())); |
|
148 | + return cal_days_in_month(CAL_GREGORIAN, (int) date('m', time()), (int) date('Y', time())); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @return int Cantidad de palabras |
319 | 319 | */ |
320 | 320 | public static function count_words(string $s) : int { |
321 | - return (int) str_word_count($s,0,'0..9_'); |
|
321 | + return (int) str_word_count($s, 0, '0..9_'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |