@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | namespace HexMakina\Lezer; |
| 11 | 11 | |
| 12 | 12 | use HexMakina\LocalFS\FileSystem; |
| 13 | -use HexMakina\Tempus\{Dato,DatoTempo,Tempo}; |
|
| 13 | +use HexMakina\Tempus\{Dato, DatoTempo, Tempo}; |
|
| 14 | 14 | |
| 15 | 15 | class Lezer extends \i18n |
| 16 | 16 | { |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | public function compileFunction() |
| 110 | 110 | { |
| 111 | 111 | return '' |
| 112 | - . "function " . $this->prefix . '($string, $args=NULL) {' . "\n" |
|
| 113 | - . ' if (!defined("' . $this->prefix . '::".$string))' |
|
| 112 | + . "function ".$this->prefix.'($string, $args=NULL) {'."\n" |
|
| 113 | + . ' if (!defined("'.$this->prefix.'::".$string))' |
|
| 114 | 114 | . ' return $string;' |
| 115 | - . ' $return = constant("' . $this->prefix . '::".$string);' . "\n" |
|
| 115 | + . ' $return = constant("'.$this->prefix.'::".$string);'."\n" |
|
| 116 | 116 | . ' return $args ? vsprintf($return,$args) : $return;' |
| 117 | 117 | . "\n}"; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function l($message, $context=[]) : string |
|
| 120 | + public function l($message, $context = []) : string |
|
| 121 | 121 | { |
| 122 | 122 | return call_user_func($this->prefix, $message, $context); |
| 123 | 123 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | try { |
| 139 | 139 | $amount_of_days = DatoTempo::days_diff(new \DateTime($event), new \DateTime()); |
| 140 | 140 | } catch (\Exception $e) { |
| 141 | - return __FUNCTION__ . ': error'; |
|
| 141 | + return __FUNCTION__.': error'; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if ($amount_of_days === -1) { |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | $label .= '_PLURAL'; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $ordering[$unit] = $qty . ' ' . L($label) . '.'; |
|
| 182 | + $ordering[$unit] = $qty.' '.L($label).'.'; |
|
| 183 | 183 | } |
| 184 | 184 | $ret = (isset($amount_of_days) && $amount_of_days >= 0) ? L('DATETIME_RANGE_PREFIX_FUTURE') : L('DATETIME_RANGE_PREFIX_PAST'); |
| 185 | - $ret .= ' ' . implode(' & ', array_slice($ordering, 0, 2)); |
|
| 185 | + $ret .= ' '.implode(' & ', array_slice($ordering, 0, 2)); |
|
| 186 | 186 | |
| 187 | 187 | return $ret; |
| 188 | 188 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | list($year, $month, $day) = explode('-', $date_string); |
| 209 | 209 | |
| 210 | - $ret = intval($day) . ' ' . L("DATETIME_CALENDAR_MONTH_$month"); |
|
| 210 | + $ret = intval($day).' '.L("DATETIME_CALENDAR_MONTH_$month"); |
|
| 211 | 211 | |
| 212 | 212 | if ($short === true && Dato::format(null, 'Y') === $year) { |
| 213 | 213 | return $ret; |
@@ -218,18 +218,18 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | public static function human_month($date_string) |
| 220 | 220 | { |
| 221 | - return $this->l('DATETIME_CALENDAR_MONTH_' . Dato::format($date_string, 'm')); |
|
| 221 | + return $this->l('DATETIME_CALENDAR_MONTH_'.Dato::format($date_string, 'm')); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | public static function human_day($date_string) |
| 225 | 225 | { |
| 226 | - return $this->l('DATETIME_CALENDAR_DAY_' . Dato::format($date_string, 'N')); |
|
| 226 | + return $this->l('DATETIME_CALENDAR_DAY_'.Dato::format($date_string, 'N')); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | public static function human_seconds($seconds) |
| 230 | 230 | { |
| 231 | 231 | $hours = floor($seconds / 3600); |
| 232 | - $mins = floor(($seconds - $hours * 3600) / 60); |
|
| 232 | + $mins = floor(($seconds-$hours * 3600) / 60); |
|
| 233 | 233 | $secs = floor($seconds % 60); |
| 234 | 234 | |
| 235 | 235 | $hours_format = '%dh %dm %ds'; |