Test Setup Failed
Pull Request — master (#69)
by
unknown
54s
created
Plugin.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function boot()
38 38
     {
39
-        $this->app->singleton('time_diff_translator', function ($app) {
39
+        $this->app->singleton('time_diff_translator', function($app) {
40 40
             $loader = $app->make('translation.loader');
41 41
             $locale = $app->config->get('app.locale');
42 42
             $translator = $app->make(TimeDiffTranslator::class, [$loader, $locale]);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $stringLoaderFunc = $stringLoader->getFunctions();
146 146
 
147 147
         return [
148
-            'template_from_string' => function ($template) use ($twig, $stringLoaderFunc) {
148
+            'template_from_string' => function($template) use ($twig, $stringLoaderFunc) {
149 149
                 $callable = $stringLoaderFunc[0]->getCallable();
150 150
                 return $callable($twig, $template);
151 151
             }
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
         $textFilters = $textExtension->getFilters();
166 166
 
167 167
         return [
168
-            'truncate' => function ($value, $length = 30, $preserve = false, $separator = '...') use ($twig, $textFilters) {
168
+            'truncate' => function($value, $length = 30, $preserve = false, $separator = '...') use ($twig, $textFilters) {
169 169
                 $callable = $textFilters[0]->getCallable();
170 170
                 return $callable($twig, $value, $length, $preserve, $separator);
171 171
             },
172
-            'wordwrap' => function ($value, $length = 80, $separator = "\n", $preserve = false) use ($twig, $textFilters) {
172
+            'wordwrap' => function($value, $length = 80, $separator = "\n", $preserve = false) use ($twig, $textFilters) {
173 173
                 $callable = $textFilters[1]->getCallable();
174 174
                 return $callable($twig, $value, $length, $separator, $preserve);
175 175
             }
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
         $intlFilters = $intlExtension->getFilters();
190 190
 
191 191
         return [
192
-            'localizeddate' => function ($date, $dateFormat = 'medium', $timeFormat = 'medium', $locale = null, $timezone = null, $format = null) use ($twig, $intlFilters) {
192
+            'localizeddate' => function($date, $dateFormat = 'medium', $timeFormat = 'medium', $locale = null, $timezone = null, $format = null) use ($twig, $intlFilters) {
193 193
                 $callable = $intlFilters[0]->getCallable();
194 194
                 return $callable($twig, $date, $dateFormat, $timeFormat, $locale, $timezone, $format);
195 195
             },
196
-            'localizednumber' => function ($number, $style = 'decimal', $type = 'default', $locale = null) use ($twig, $intlFilters) {
196
+            'localizednumber' => function($number, $style = 'decimal', $type = 'default', $locale = null) use ($twig, $intlFilters) {
197 197
                 $callable = $intlFilters[1]->getCallable();
198 198
                 return $callable($number, $style, $type, $locale);
199 199
             },
200
-            'localizedcurrency' => function ($number, $currency = null, $locale = null) use ($twig, $intlFilters) {
200
+            'localizedcurrency' => function($number, $currency = null, $locale = null) use ($twig, $intlFilters) {
201 201
                 $callable = $intlFilters[2]->getCallable();
202 202
                 return $callable($number, $currency, $locale);
203 203
             }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $arrayFilters = $arrayExtension->getFilters();
216 216
 
217 217
         return [
218
-            'shuffle' => function ($array) use ($arrayFilters) {
218
+            'shuffle' => function($array) use ($arrayFilters) {
219 219
                 $callable = $arrayFilters[0]->getCallable();
220 220
                 return $callable($array);
221 221
             }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $timeFilters = $timeExtension->getFilters();
237 237
 
238 238
         return [
239
-            'time_diff' => function ($date, $now = null) use ($twig, $timeFilters) {
239
+            'time_diff' => function($date, $now = null) use ($twig, $timeFilters) {
240 240
                 $callable = $timeFilters[0]->getCallable();
241 241
                 return $callable($twig, $date, $now);
242 242
             }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         $filters = $extension->getFilters();
255 255
 
256 256
         return [
257
-            'sortbyfield' => function ($array, $sort_by = null, $direction = 'asc') use ($filters) {
257
+            'sortbyfield' => function($array, $sort_by = null, $direction = 'asc') use ($filters) {
258 258
                 $callable = $filters[0]->getCallable();
259 259
                 return $callable($array, $sort_by, $direction);
260 260
             }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     private function getMailFilters()
270 270
     {
271 271
         return [
272
-            'mailto' => function ($string, $link = true, $protected = true, $text = null, $class = "") {
272
+            'mailto' => function($string, $link = true, $protected = true, $text = null, $class = "") {
273 273
                 return $this->hideEmail($string, $link, $protected, $text, $class);
274 274
             }
275 275
         ];
@@ -283,60 +283,60 @@  discard block
 block discarded – undo
283 283
     private function getPhpFunctions()
284 284
     {
285 285
         return [
286
-            'strftime' => function ($time, $format = '%d.%m.%Y %H:%M:%S') {
286
+            'strftime' => function($time, $format = '%d.%m.%Y %H:%M:%S') {
287 287
                 $timeObj = new Carbon($time);
288 288
                 return strftime($format, $timeObj->getTimestamp());
289 289
             },
290
-            'uppercase' => function ($string) {
290
+            'uppercase' => function($string) {
291 291
                 return mb_convert_case($string, MB_CASE_UPPER, "UTF-8");
292 292
             },
293
-            'lowercase' => function ($string) {
293
+            'lowercase' => function($string) {
294 294
                 return mb_convert_case($string, MB_CASE_LOWER, "UTF-8");
295 295
             },
296
-            'ucfirst' => function ($string) {
296
+            'ucfirst' => function($string) {
297 297
                 return ucfirst($string);
298 298
             },
299
-            'lcfirst' => function ($string) {
299
+            'lcfirst' => function($string) {
300 300
                 return lcfirst($string);
301 301
             },
302
-            'ltrim' => function ($string, $charlist = " \t\n\r\0\x0B") {
302
+            'ltrim' => function($string, $charlist = " \t\n\r\0\x0B") {
303 303
                 return ltrim($string, $charlist);
304 304
             },
305
-            'rtrim' => function ($string, $charlist = " \t\n\r\0\x0B") {
305
+            'rtrim' => function($string, $charlist = " \t\n\r\0\x0B") {
306 306
                 return rtrim($string, $charlist);
307 307
             },
308
-            'str_repeat' => function ($string, $multiplier = 1) {
308
+            'str_repeat' => function($string, $multiplier = 1) {
309 309
                 return str_repeat($string, $multiplier);
310 310
             },
311
-            'plural' => function ($string, $count = 2) {
311
+            'plural' => function($string, $count = 2) {
312 312
                 return str_plural($string, $count);
313 313
             },
314
-            'strpad' => function ($string, $pad_length, $pad_string = ' ') {
314
+            'strpad' => function($string, $pad_length, $pad_string = ' ') {
315 315
                 return str_pad($string, $pad_length, $pad_string, $pad_type = STR_PAD_BOTH);
316 316
             },
317
-            'leftpad' => function ($string, $pad_length, $pad_string = ' ') {
317
+            'leftpad' => function($string, $pad_length, $pad_string = ' ') {
318 318
                 return str_pad($string, $pad_length, $pad_string, $pad_type = STR_PAD_LEFT);
319 319
             },
320
-            'rightpad' => function ($string, $pad_length, $pad_string = ' ') {
320
+            'rightpad' => function($string, $pad_length, $pad_string = ' ') {
321 321
                 return str_pad($string, $pad_length, $pad_string, $pad_type = STR_PAD_RIGHT);
322 322
             },
323
-            'rtl' => function ($string) {
323
+            'rtl' => function($string) {
324 324
                 return strrev($string);
325 325
             },
326
-            'str_replace' => function ($string, $search, $replace) {
326
+            'str_replace' => function($string, $search, $replace) {
327 327
                 return str_replace($search, $replace, $string);
328 328
             },
329
-            'strip_tags' => function ($string, $allow = '') {
329
+            'strip_tags' => function($string, $allow = '') {
330 330
                 return strip_tags($string, $allow);
331 331
             },
332
-            'var_dump' => function ($expression) {
332
+            'var_dump' => function($expression) {
333 333
                 ob_start();
334 334
                 var_dump($expression);
335 335
                 $result = ob_get_clean();
336 336
 
337 337
                 return $result;
338 338
             },
339
-            'shuffle' => function ($array) {
339
+            'shuffle' => function($array) {
340 340
                 if (!is_array($array)) return $array;
341 341
 
342 342
                 $keys = array_keys($array);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     private function getConfigFunction()
359 359
     {
360 360
         return [
361
-            'config' => function ($key = null, $default = null) {
361
+            'config' => function($key = null, $default = null) {
362 362
                 return config($key, $default);
363 363
             },
364 364
         ];
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     private function getEnvFunction()
373 373
     {
374 374
         return [
375
-            'env' => function ($key, $default = null) {
375
+            'env' => function($key, $default = null) {
376 376
                 return env($key, $default);
377 377
             },
378 378
         ];
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     private function getSessionFunction()
387 387
     {
388 388
         return [
389
-            'session' => function ($key = null) {
389
+            'session' => function($key = null) {
390 390
                 return session($key);
391 391
             },
392 392
         ];
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     private function getTransFunction()
401 401
     {
402 402
         return [
403
-            'trans' => function ($key = null, $parameters = []) {
403
+            'trans' => function($key = null, $parameters = []) {
404 404
                 return trans($key, $parameters);
405 405
             },
406 406
         ];
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
     private function getVarDumpFunction()
415 415
     {
416 416
         return [
417
-            'var_dump' => function ($expression) {
417
+            'var_dump' => function($expression) {
418 418
                 ob_start();
419 419
                 var_dump($expression);
420 420
                 $result = ob_get_clean();
@@ -446,32 +446,32 @@  discard block
 block discarded – undo
446 446
 
447 447
         // if we want just unprotected link
448 448
         if (!$protected) {
449
-            return $link ? '<a href="mailto:' . $email . '">' . $linkText . '</a>' : $linkText;
449
+            return $link ? '<a href="mailto:'.$email.'">'.$linkText.'</a>' : $linkText;
450 450
         }
451 451
 
452 452
         // turn on protection
453 453
         $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
454 454
         $key = str_shuffle($character_set);
455 455
         $cipher_text = '';
456
-        $id = 'e' . rand(1, 999999999);
456
+        $id = 'e'.rand(1, 999999999);
457 457
         for ($i = 0; $i < strlen($email); $i += 1) {
458 458
             $cipher_text .= $key[strpos($character_set, $email[$i])];
459 459
         }
460
-        $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d=""; var cl="'.$class.'";';
460
+        $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d=""; var cl="'.$class.'";';
461 461
         $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));';
462 462
         $script .= 'var y = d;';
463 463
         if ($text !== null) {
464 464
             $script .= 'var y = "'.$text.'";';
465 465
         }
466 466
         if ($link) {
467
-            $script .= 'document.getElementById("' . $id . '").innerHTML="<a class=\""+cl+"\" href=\\"mailto:"+d+"\\">"+y+"</a>"';
467
+            $script .= 'document.getElementById("'.$id.'").innerHTML="<a class=\""+cl+"\" href=\\"mailto:"+d+"\\">"+y+"</a>"';
468 468
         } else {
469
-            $script .= 'document.getElementById("' . $id . '").innerHTML=y';
469
+            $script .= 'document.getElementById("'.$id.'").innerHTML=y';
470 470
         }
471
-        $script = "eval(\"" . str_replace(array("\\", '"'), array("\\\\", '\"'), $script) . "\")";
472
-        $script = '<script type="text/javascript">/*<![CDATA[*/' . $script . '/*]]>*/</script>';
471
+        $script = "eval(\"".str_replace(array("\\", '"'), array("\\\\", '\"'), $script)."\")";
472
+        $script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>';
473 473
 
474
-        return '<span id="' . $id . '">[javascript protected email address]</span>' . $script;
474
+        return '<span id="'.$id.'">[javascript protected email address]</span>'.$script;
475 475
     }
476 476
 
477 477
     /**
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
     private function getFileRevision()
487 487
     {
488 488
         return [
489
-            'revision' => function ($filename, $format = null) {
489
+            'revision' => function($filename, $format = null) {
490 490
                 // Remove http/web address from the file name if there is one to load it locally
491 491
                 $prefix = url('/');
492
-                $filename_ = trim(preg_replace('/^' . preg_quote($prefix, '/') . '/', '', $filename), '/');
492
+                $filename_ = trim(preg_replace('/^'.preg_quote($prefix, '/').'/', '', $filename), '/');
493 493
                 if (file_exists($filename_)) {
494 494
                     $timestamp = filemtime($filename_);
495 495
                     $prepend = ($format) ? date($format, $timestamp) : $timestamp;
496 496
 
497
-                    return $filename . "?" . $prepend;
497
+                    return $filename."?".$prepend;
498 498
                 }
499 499
 
500 500
                 return $filename;
Please login to merge, or discard this patch.