Test Setup Failed
Pull Request — master (#69)
by
unknown
01:22
created
Plugin.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
         // add String Loader functions
68 68
         // INFO:
69 69
         /**
70
-        * things like e.g. wordwrap or truncate can be done in Twig v3.x with
71
-        * 'Lorem ipsum'|u.wordwrap(5) or
72
-        * 'Lorem ipsum'|u.truncate(8, '...') repectively.
73
-        */
70
+         * things like e.g. wordwrap or truncate can be done in Twig v3.x with
71
+         * 'Lorem ipsum'|u.wordwrap(5) or
72
+         * 'Lorem ipsum'|u.truncate(8, '...') repectively.
73
+         */
74 74
         //$functions += $this->getStringLoaderFunctions($twig);
75 75
 
76 76
         // add Config function
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
         // add Text extensions
92 92
         // INFO:
93 93
         /**
94
-        * things like e.g. wordwrap or truncate can be done in Twig v3.x with
95
-        * 'Lorem ipsum'|u.wordwrap(5) or
96
-        * 'Lorem ipsum'|u.truncate(8, '...') repectively.
97
-        */
94
+         * things like e.g. wordwrap or truncate can be done in Twig v3.x with
95
+         * 'Lorem ipsum'|u.wordwrap(5) or
96
+         * 'Lorem ipsum'|u.truncate(8, '...') repectively.
97
+         */
98 98
         //$filters += $this->getTextFilters($twig);
99 99
 
100 100
         // add Intl extensions if php5-intl installed
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
         // add Array extensions
106 106
         // INFO:
107 107
         /**
108
-        * shuffle moved to getPhpFunctions()
109
-        */
108
+         * shuffle moved to getPhpFunctions()
109
+         */
110 110
         //$filters += $this->getArrayFilters();
111 111
 
112 112
         // add Time extensions
Please login to merge, or discard this 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
                 var_dump($array);
341 341
                 if (!is_array($array)) return $array;
342 342
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
     private function getConfigFunction()
360 360
     {
361 361
         return [
362
-            'config' => function ($key = null, $default = null) {
362
+            'config' => function($key = null, $default = null) {
363 363
                 return config($key, $default);
364 364
             },
365 365
         ];
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     private function getEnvFunction()
374 374
     {
375 375
         return [
376
-            'env' => function ($key, $default = null) {
376
+            'env' => function($key, $default = null) {
377 377
                 return env($key, $default);
378 378
             },
379 379
         ];
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     private function getSessionFunction()
388 388
     {
389 389
         return [
390
-            'session' => function ($key = null) {
390
+            'session' => function($key = null) {
391 391
                 return session($key);
392 392
             },
393 393
         ];
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     private function getTransFunction()
402 402
     {
403 403
         return [
404
-            'trans' => function ($key = null, $parameters = []) {
404
+            'trans' => function($key = null, $parameters = []) {
405 405
                 return trans($key, $parameters);
406 406
             },
407 407
         ];
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     private function getVarDumpFunction()
416 416
     {
417 417
         return [
418
-            'var_dump' => function ($expression) {
418
+            'var_dump' => function($expression) {
419 419
                 ob_start();
420 420
                 var_dump($expression);
421 421
                 $result = ob_get_clean();
@@ -447,32 +447,32 @@  discard block
 block discarded – undo
447 447
 
448 448
         // if we want just unprotected link
449 449
         if (!$protected) {
450
-            return $link ? '<a href="mailto:' . $email . '">' . $linkText . '</a>' : $linkText;
450
+            return $link ? '<a href="mailto:'.$email.'">'.$linkText.'</a>' : $linkText;
451 451
         }
452 452
 
453 453
         // turn on protection
454 454
         $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
455 455
         $key = str_shuffle($character_set);
456 456
         $cipher_text = '';
457
-        $id = 'e' . rand(1, 999999999);
457
+        $id = 'e'.rand(1, 999999999);
458 458
         for ($i = 0; $i < strlen($email); $i += 1) {
459 459
             $cipher_text .= $key[strpos($character_set, $email[$i])];
460 460
         }
461
-        $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d=""; var cl="'.$class.'";';
461
+        $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d=""; var cl="'.$class.'";';
462 462
         $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));';
463 463
         $script .= 'var y = d;';
464 464
         if ($text !== null) {
465 465
             $script .= 'var y = "'.$text.'";';
466 466
         }
467 467
         if ($link) {
468
-            $script .= 'document.getElementById("' . $id . '").innerHTML="<a class=\""+cl+"\" href=\\"mailto:"+d+"\\">"+y+"</a>"';
468
+            $script .= 'document.getElementById("'.$id.'").innerHTML="<a class=\""+cl+"\" href=\\"mailto:"+d+"\\">"+y+"</a>"';
469 469
         } else {
470
-            $script .= 'document.getElementById("' . $id . '").innerHTML=y';
470
+            $script .= 'document.getElementById("'.$id.'").innerHTML=y';
471 471
         }
472
-        $script = "eval(\"" . str_replace(array("\\", '"'), array("\\\\", '\"'), $script) . "\")";
473
-        $script = '<script type="text/javascript">/*<![CDATA[*/' . $script . '/*]]>*/</script>';
472
+        $script = "eval(\"".str_replace(array("\\", '"'), array("\\\\", '\"'), $script)."\")";
473
+        $script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>';
474 474
 
475
-        return '<span id="' . $id . '">[javascript protected email address]</span>' . $script;
475
+        return '<span id="'.$id.'">[javascript protected email address]</span>'.$script;
476 476
     }
477 477
 
478 478
     /**
@@ -487,15 +487,15 @@  discard block
 block discarded – undo
487 487
     private function getFileRevision()
488 488
     {
489 489
         return [
490
-            'revision' => function ($filename, $format = null) {
490
+            'revision' => function($filename, $format = null) {
491 491
                 // Remove http/web address from the file name if there is one to load it locally
492 492
                 $prefix = url('/');
493
-                $filename_ = trim(preg_replace('/^' . preg_quote($prefix, '/') . '/', '', $filename), '/');
493
+                $filename_ = trim(preg_replace('/^'.preg_quote($prefix, '/').'/', '', $filename), '/');
494 494
                 if (file_exists($filename_)) {
495 495
                     $timestamp = filemtime($filename_);
496 496
                     $prepend = ($format) ? date($format, $timestamp) : $timestamp;
497 497
 
498
-                    return $filename . "?" . $prepend;
498
+                    return $filename."?".$prepend;
499 499
                 }
500 500
 
501 501
                 return $filename;
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -338,13 +338,16 @@
 block discarded – undo
338 338
             },
339 339
             'shuffle' => function ($array) {
340 340
                 var_dump($array);
341
-                if (!is_array($array)) return $array;
341
+                if (!is_array($array)) {
342
+                    return $array;
343
+                }
342 344
 
343 345
                 $keys = array_keys($array);
344 346
                 shuffle($keys);
345 347
                 $random = array();
346
-                foreach ($keys as $key)
347
-                    $random[$key] = $array[$key];
348
+                foreach ($keys as $key) {
349
+                                    $random[$key] = $array[$key];
350
+                }
348 351
 
349 352
                 return $random;
350 353
             },
Please login to merge, or discard this patch.