Passed
Push — main ( 4012f7...8407cf )
by Sammy
01:30
created
Lezer.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -251,14 +251,14 @@
 block discarded – undo
251 251
                 $config = array_replace_recursive($this->load($this->getConfigFilename($this->fallbackLang)), $config);
252 252
 
253 253
             $compiled = "<?php class " . $this->prefix . " {\n"
254
-            	. $this->compile($config)
255
-            	. 'public static function __callStatic($string, $args) {' . "\n"
256
-            	. '    return vsprintf(constant("self::" . $string), $args);'
257
-            	. "\n}\n}\n"
254
+              . $this->compile($config)
255
+              . 'public static function __callStatic($string, $args) {' . "\n"
256
+              . '    return vsprintf(constant("self::" . $string), $args);'
257
+              . "\n}\n}\n"
258 258
               . $this->compileFunction();
259 259
 
260
-			if( ! is_dir($this->cachePath))
261
-				mkdir($this->cachePath, 0755, true);
260
+      if( ! is_dir($this->cachePath))
261
+        mkdir($this->cachePath, 0755, true);
262 262
 
263 263
             if (file_put_contents($this->cacheFilePath, $compiled) === FALSE) {
264 264
                 throw new \Exception("Could not write cache file to path '" . $this->cacheFilePath . "'. Is it writable?");
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 namespace HexMakina\Lezer;
12 12
 
13 13
 use \HexMakina\LocalFS\FileSystem;
14
-use \HexMakina\Tempus\{Dato,DatoTempo,Tempo};
14
+use \HexMakina\Tempus\{Dato, DatoTempo, Tempo};
15 15
 
16 16
 class Lezer extends \i18n
17 17
 {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         try {
115 115
             $amount_of_days = DatoTempo::days_diff(new \DateTime($event), new \DateTime());
116 116
         } catch (\Exception $e) {
117
-            return __FUNCTION__ . ': error';
117
+            return __FUNCTION__.': error';
118 118
         }
119 119
 
120 120
         if ($amount_of_days === -1) {
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
                 $label .= '_PLURAL';
158 158
             }
159 159
 
160
-            $ordering[$unit] = $qty . ' ' . $this->l($label) . '.';
160
+            $ordering[$unit] = $qty.' '.$this->l($label).'.';
161 161
         }
162 162
         $ret = 'DATETIME_RANGE_PREFIX_';
163
-        $ret.= (isset($amount_of_days) && $amount_of_days >= 0) ? 'FUTURE' : 'PAST';
164
-        $ret = $this->l($ret) . ' ' . implode(' & ', array_slice($ordering, 0, 2));
163
+        $ret .= (isset($amount_of_days) && $amount_of_days >= 0) ? 'FUTURE' : 'PAST';
164
+        $ret = $this->l($ret).' '.implode(' & ', array_slice($ordering, 0, 2));
165 165
 
166 166
         return $ret;
167 167
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         list($year, $month, $day) = explode('-', $date_string);
188 188
 
189
-        $ret = intval($day) . ' ' . $this->l("DATETIME_CALENDAR_MONTH_$month");
189
+        $ret = intval($day).' '.$this->l("DATETIME_CALENDAR_MONTH_$month");
190 190
 
191 191
         if ($short === true && Dato::format(null, 'Y') === $year) {
192 192
             return $ret;
@@ -197,18 +197,18 @@  discard block
 block discarded – undo
197 197
 
198 198
     public function month($date_string)
199 199
     {
200
-        return $this->l('DATETIME_CALENDAR_MONTH_' . Dato::format($date_string, 'm'));
200
+        return $this->l('DATETIME_CALENDAR_MONTH_'.Dato::format($date_string, 'm'));
201 201
     }
202 202
 
203 203
     public function day($date_string)
204 204
     {
205
-        return $this->l('DATETIME_CALENDAR_DAY_' . Dato::format($date_string, 'N'));
205
+        return $this->l('DATETIME_CALENDAR_DAY_'.Dato::format($date_string, 'N'));
206 206
     }
207 207
 
208 208
     public function seconds($seconds)
209 209
     {
210 210
         $hours = floor($seconds / 3600);
211
-        $mins = floor(($seconds - $hours * 3600) / 60);
211
+        $mins = floor(($seconds-$hours * 3600) / 60);
212 212
         $secs = floor($seconds % 60);
213 213
 
214 214
         $hours_format = '%dh %dm %ds';
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
     public function init() {
219 219
         if ($this->isInitialized()) {
220
-            throw new \BadMethodCallException('This object from class ' . __CLASS__ . ' is already initialized. It is not possible to init one object twice!');
220
+            throw new \BadMethodCallException('This object from class '.__CLASS__.' is already initialized. It is not possible to init one object twice!');
221 221
         }
222 222
 
223 223
         $this->isInitialized = true;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         }
239 239
 
240 240
         // search for cache file
241
-        $this->cacheFilePath = $this->cachePath . '/php_i18n_' . md5_file(__FILE__) . '_' . $this->prefix . '_' . $this->appliedLang . '.cache.php';
241
+        $this->cacheFilePath = $this->cachePath.'/php_i18n_'.md5_file(__FILE__).'_'.$this->prefix.'_'.$this->appliedLang.'.cache.php';
242 242
 
243 243
         // whether we need to create a new cache file
244 244
         $outdated = !file_exists($this->cacheFilePath) ||
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
             if ($this->mergeFallback)
251 251
                 $config = array_replace_recursive($this->load($this->getConfigFilename($this->fallbackLang)), $config);
252 252
 
253
-            $compiled = "<?php class " . $this->prefix . " {\n"
253
+            $compiled = "<?php class ".$this->prefix." {\n"
254 254
             	. $this->compile($config)
255
-            	. 'public static function __callStatic($string, $args) {' . "\n"
255
+            	. 'public static function __callStatic($string, $args) {'."\n"
256 256
             	. '    return vsprintf(constant("self::" . $string), $args);'
257 257
             	. "\n}\n}\n"
258 258
               . $this->compileFunction();
259 259
 
260
-			if( ! is_dir($this->cachePath))
260
+			if (!is_dir($this->cachePath))
261 261
 				mkdir($this->cachePath, 0755, true);
262 262
 
263 263
             if (file_put_contents($this->cacheFilePath, $compiled) === FALSE) {
264
-                throw new \Exception("Could not write cache file to path '" . $this->cacheFilePath . "'. Is it writable?");
264
+                throw new \Exception("Could not write cache file to path '".$this->cacheFilePath."'. Is it writable?");
265 265
             }
266 266
             chmod($this->cacheFilePath, 0755);
267 267
 
@@ -273,17 +273,17 @@  discard block
 block discarded – undo
273 273
     public function compileFunction()
274 274
     {
275 275
         return ''
276
-        . "function " . $this->prefix . '($string, $args=NULL) {' . "\n"
277
-        . '    if (!defined("' . $this->prefix . '::".$string))'
276
+        . "function ".$this->prefix.'($string, $args=NULL) {'."\n"
277
+        . '    if (!defined("'.$this->prefix.'::".$string))'
278 278
         . '       return $string;'
279
-        . '    $return = constant("' . $this->prefix . '::".$string);' . "\n"
279
+        . '    $return = constant("'.$this->prefix.'::".$string);'."\n"
280 280
         . '    return $args ? vsprintf($return,$args) : $return;'
281 281
         . "\n}";
282 282
     }
283 283
 
284 284
     public function l($message, $context = []): string
285 285
     {
286
-        foreach($context as $i => $context_message)
286
+        foreach ($context as $i => $context_message)
287 287
           $context[$i] = $this->l($context_message);
288 288
 
289 289
         return call_user_func($this->prefix, $message, $context);
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -247,8 +247,9 @@  discard block
 block discarded – undo
247 247
 
248 248
         if ($outdated) {
249 249
             $config = $this->load($this->langFilePath);
250
-            if ($this->mergeFallback)
251
-                $config = array_replace_recursive($this->load($this->getConfigFilename($this->fallbackLang)), $config);
250
+            if ($this->mergeFallback) {
251
+                            $config = array_replace_recursive($this->load($this->getConfigFilename($this->fallbackLang)), $config);
252
+            }
252 253
 
253 254
             $compiled = "<?php class " . $this->prefix . " {\n"
254 255
             	. $this->compile($config)
@@ -257,8 +258,9 @@  discard block
 block discarded – undo
257 258
             	. "\n}\n}\n"
258 259
               . $this->compileFunction();
259 260
 
260
-			if( ! is_dir($this->cachePath))
261
-				mkdir($this->cachePath, 0755, true);
261
+			if( ! is_dir($this->cachePath)) {
262
+							mkdir($this->cachePath, 0755, true);
263
+			}
262 264
 
263 265
             if (file_put_contents($this->cacheFilePath, $compiled) === FALSE) {
264 266
                 throw new \Exception("Could not write cache file to path '" . $this->cacheFilePath . "'. Is it writable?");
@@ -283,8 +285,9 @@  discard block
 block discarded – undo
283 285
 
284 286
     public function l($message, $context = []): string
285 287
     {
286
-        foreach($context as $i => $context_message)
287
-          $context[$i] = $this->l($context_message);
288
+        foreach($context as $i => $context_message) {
289
+                  $context[$i] = $this->l($context_message);
290
+        }
288 291
 
289 292
         return call_user_func($this->prefix, $message, $context);
290 293
     }
Please login to merge, or discard this patch.