Passed
Push — develop ( 067c9c...bf1d25 )
by nguereza
04:45
created
src/Cache/NullCache.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,24 +56,24 @@  discard block
 block discarded – undo
56 56
 class NullCache extends AbstractCache
57 57
 {
58 58
     /**
59
-    * {@inheritdoc}
60
-    */
59
+     * {@inheritdoc}
60
+     */
61 61
     public function read(string $key, bool $unserialize = false)
62 62
     {
63 63
         return false;
64 64
     }
65 65
 
66 66
     /**
67
-    * {@inheritdoc}
68
-    */
67
+     * {@inheritdoc}
68
+     */
69 69
     public function exists(string $key): bool
70 70
     {
71 71
         return false;
72 72
     }
73 73
 
74 74
     /**
75
-    * {@inheritdoc}
76
-    */
75
+     * {@inheritdoc}
76
+     */
77 77
     public function write(string $key, $value, bool $serialize = false): bool
78 78
     {
79 79
         return true;
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 
82 82
 
83 83
     /**
84
-    * {@inheritdoc}
85
-    */
84
+     * {@inheritdoc}
85
+     */
86 86
     public function flush(bool $expired = false): bool
87 87
     {
88 88
         return true;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,13 +53,11 @@
 block discarded – undo
53 53
  * Class NullCache
54 54
  * @package Platine\Template\Cache
55 55
  */
56
-class NullCache extends AbstractCache
57
-{
56
+class NullCache extends AbstractCache {
58 57
     /**
59 58
     * {@inheritdoc}
60 59
     */
61
-    public function read(string $key, bool $unserialize = false)
62
-    {
60
+    public function read(string $key, bool $unserialize = false) {
63 61
         return false;
64 62
     }
65 63
 
Please login to merge, or discard this patch.
src/Cache/AbstractCache.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * Class AbstractCache
56 56
  * @package Platine\Template\Cache
57 57
  */
58
-abstract class AbstractCache
59
-{
58
+abstract class AbstractCache {
60 59
 
61 60
     /**
62 61
      * The cache expiration in second
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
      * Create new instance
81 80
      * @param Configuration $config
82 81
      */
83
-    public function __construct(Configuration $config)
84
-    {
82
+    public function __construct(Configuration $config) {
85 83
         $this->config = $config;
86 84
 
87 85
         $this->expire = $config->getCacheExpire();
Please login to merge, or discard this patch.
src/Cache/ApcCache.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     }
75 75
 
76 76
     /**
77
-    * {@inheritdoc}
78
-    */
77
+     * {@inheritdoc}
78
+     */
79 79
     public function read(string $key, bool $unserialize = true)
80 80
     {
81 81
         $success = false;
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
     }
86 86
 
87 87
     /**
88
-    * {@inheritdoc}
89
-    */
88
+     * {@inheritdoc}
89
+     */
90 90
     public function exists(string $key): bool
91 91
     {
92 92
         return apcu_exists($this->prefix . $key) === true;
93 93
     }
94 94
 
95 95
     /**
96
-    * {@inheritdoc}
97
-    */
96
+     * {@inheritdoc}
97
+     */
98 98
     public function write(string $key, $value, bool $serialize = true): bool
99 99
     {
100 100
         return apcu_store($this->prefix . $key, $value, $this->expire);
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 
103 103
 
104 104
     /**
105
-    * {@inheritdoc}
106
-    */
105
+     * {@inheritdoc}
106
+     */
107 107
     public function flush(bool $expired = false): bool
108 108
     {
109 109
         return apcu_clear_cache();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,15 +56,13 @@  discard block
 block discarded – undo
56 56
  * Class ApcCache
57 57
  * @package Platine\Template\Cache
58 58
  */
59
-class ApcCache extends AbstractCache
60
-{
59
+class ApcCache extends AbstractCache {
61 60
 
62 61
     /**
63 62
      * Create new instance
64 63
      * @param Configuration $config
65 64
      */
66
-    public function __construct(Configuration $config)
67
-    {
65
+    public function __construct(Configuration $config) {
68 66
         parent::__construct($config);
69 67
 
70 68
         if ((!extension_loaded('apcu')) || !((bool) ini_get('apc.enabled'))) {
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
     /**
77 75
     * {@inheritdoc}
78 76
     */
79
-    public function read(string $key, bool $unserialize = true)
80
-    {
77
+    public function read(string $key, bool $unserialize = true) {
81 78
         $success = false;
82 79
         $data = apcu_fetch($this->prefix . $key, $success);
83 80
 
Please login to merge, or discard this patch.
src/Cache/MemoryCache.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     protected array $data = [];
63 63
 
64 64
     /**
65
-    * {@inheritdoc}
66
-    */
65
+     * {@inheritdoc}
66
+     */
67 67
     public function read(string $key, bool $unserialize = false)
68 68
     {
69 69
         if (!$this->exists($key)) {
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
     }
75 75
 
76 76
     /**
77
-    * {@inheritdoc}
78
-    */
77
+     * {@inheritdoc}
78
+     */
79 79
     public function exists(string $key): bool
80 80
     {
81 81
         return isset($this->data[$key]);
82 82
     }
83 83
 
84 84
     /**
85
-    * {@inheritdoc}
86
-    */
85
+     * {@inheritdoc}
86
+     */
87 87
     public function write(string $key, $value, bool $serialize = false): bool
88 88
     {
89 89
         $this->data[$key] = $value;
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 
94 94
 
95 95
     /**
96
-    * {@inheritdoc}
97
-    */
96
+     * {@inheritdoc}
97
+     */
98 98
     public function flush(bool $expired = false): bool
99 99
     {
100 100
         $this->data = [];
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
  * Class MemoryCache
54 54
  * @package Platine\Template\Cache
55 55
  */
56
-class MemoryCache extends AbstractCache
57
-{
56
+class MemoryCache extends AbstractCache {
58 57
     /**
59 58
      * The cache data
60 59
      * @var array<string, mixed>
@@ -64,8 +63,7 @@  discard block
 block discarded – undo
64 63
     /**
65 64
     * {@inheritdoc}
66 65
     */
67
-    public function read(string $key, bool $unserialize = false)
68
-    {
66
+    public function read(string $key, bool $unserialize = false) {
69 67
         if (!$this->exists($key)) {
70 68
             return false;
71 69
         }
Please login to merge, or discard this patch.
src/Template.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@
 block discarded – undo
60 60
  * Class Template
61 61
  * @package Platine\Template
62 62
  */
63
-class Template
64
-{
63
+class Template {
65 64
 
66 65
     /**
67 66
      * The configuration instance
Please login to merge, or discard this patch.
src/Filter/StringFilter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -387,7 +387,7 @@
 block discarded – undo
387 387
 
388 388
         return (string) preg_replace_callback(
389 389
             '/(^|[^\p{L}\'])([\p{Ll}])/u',
390
-            function ($matches) {
390
+            function($matches) {
391 391
                 return $matches[1] . ucfirst($matches[2]);
392 392
             },
393 393
             ucwords($variable)
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -56,16 +56,14 @@  discard block
 block discarded – undo
56 56
  * Class StringFilter
57 57
  * @package Platine\Template\Filter
58 58
  */
59
-class StringFilter extends AbstractFilter
60
-{
59
+class StringFilter extends AbstractFilter {
61 60
 
62 61
     /**
63 62
      * Return the length of string or array
64 63
      * @param mixed $variable
65 64
      * @return int|mixed
66 65
      */
67
-    public static function length($variable)
68
-    {
66
+    public static function length($variable) {
69 67
         if ($variable instanceof Traversable) {
70 68
             return iterator_count($variable);
71 69
         }
@@ -97,8 +95,7 @@  discard block
 block discarded – undo
97 95
      * @param mixed $value
98 96
      * @return string|mixed
99 97
      */
100
-    public static function append($variable, $value)
101
-    {
98
+    public static function append($variable, $value) {
102 99
         if (!is_string($variable) || !is_string($value)) {
103 100
             return $variable;
104 101
         }
@@ -112,8 +109,7 @@  discard block
 block discarded – undo
112 109
      * @param mixed $value
113 110
      * @return string|mixed
114 111
      */
115
-    public static function prepend($variable, $value)
116
-    {
112
+    public static function prepend($variable, $value) {
117 113
         if (!is_string($variable) || !is_string($value)) {
118 114
             return $variable;
119 115
         }
@@ -127,8 +123,7 @@  discard block
 block discarded – undo
127 123
      * @param mixed $value
128 124
      * @return string|mixed
129 125
      */
130
-    public static function remove($variable, $value)
131
-    {
126
+    public static function remove($variable, $value) {
132 127
         if (!is_string($variable) || !is_string($value)) {
133 128
             return $variable;
134 129
         }
@@ -143,8 +138,7 @@  discard block
 block discarded – undo
143 138
      * @param mixed $replacement
144 139
      * @return string|mixed
145 140
      */
146
-    public static function replace($variable, $value, $replacement = '')
147
-    {
141
+    public static function replace($variable, $value, $replacement = '') {
148 142
         if (!is_string($variable) || !is_string($value) || !is_string($replacement)) {
149 143
             return $variable;
150 144
         }
@@ -159,8 +153,7 @@  discard block
 block discarded – undo
159 153
      * @param string|mixed $ending
160 154
      * @return string|mixed
161 155
      */
162
-    public static function truncate($variable, $count = 100, $ending = '...')
163
-    {
156
+    public static function truncate($variable, $count = 100, $ending = '...') {
164 157
         if (!is_string($variable) || !is_string($ending) || !is_numeric($count)) {
165 158
             return $variable;
166 159
         }
@@ -180,8 +173,7 @@  discard block
 block discarded – undo
180 173
      * @param string|mixed $ending
181 174
      * @return string|mixed
182 175
      */
183
-    public static function truncateWord($variable, $count = 3, $ending = '...')
184
-    {
176
+    public static function truncateWord($variable, $count = 3, $ending = '...') {
185 177
         if (!is_string($variable) || !is_string($ending) || !is_numeric($count)) {
186 178
             return $variable;
187 179
         }
@@ -200,8 +192,7 @@  discard block
 block discarded – undo
200 192
      * @param mixed $variable
201 193
      * @return string|mixed
202 194
      */
203
-    public static function upper($variable)
204
-    {
195
+    public static function upper($variable) {
205 196
         if (!is_string($variable)) {
206 197
             return $variable;
207 198
         }
@@ -218,8 +209,7 @@  discard block
 block discarded – undo
218 209
      * @param mixed $variable
219 210
      * @return string|mixed
220 211
      */
221
-    public static function urlEncode($variable)
222
-    {
212
+    public static function urlEncode($variable) {
223 213
         if (!is_string($variable)) {
224 214
             return $variable;
225 215
         }
@@ -232,8 +222,7 @@  discard block
 block discarded – undo
232 222
      * @param mixed $variable
233 223
      * @return string|mixed
234 224
      */
235
-    public static function urlDecode($variable)
236
-    {
225
+    public static function urlDecode($variable) {
237 226
         if (!is_string($variable)) {
238 227
             return $variable;
239 228
         }
@@ -246,8 +235,7 @@  discard block
 block discarded – undo
246 235
      * @param mixed $variable
247 236
      * @return string|mixed
248 237
      */
249
-    public static function stringfy($variable)
250
-    {
238
+    public static function stringfy($variable) {
251 239
         if (is_array($variable)) {
252 240
             return $variable;
253 241
         }
@@ -262,8 +250,7 @@  discard block
 block discarded – undo
262 250
      * @param mixed $pattern
263 251
      * @return array<mixed>|mixed
264 252
      */
265
-    public static function split($variable, $pattern)
266
-    {
253
+    public static function split($variable, $pattern) {
267 254
         if (!is_string($variable) || !is_string($pattern)) {
268 255
             return $variable;
269 256
         }
@@ -276,8 +263,7 @@  discard block
 block discarded – undo
276 263
      * @param mixed $variable
277 264
      * @return string|mixed
278 265
      */
279
-    public static function raw($variable)
280
-    {
266
+    public static function raw($variable) {
281 267
         return $variable;
282 268
     }
283 269
 
@@ -286,8 +272,7 @@  discard block
 block discarded – undo
286 272
      * @param mixed $variable
287 273
      * @return string|mixed
288 274
      */
289
-    public static function escape($variable)
290
-    {
275
+    public static function escape($variable) {
291 276
         if (!is_string($variable)) {
292 277
             return $variable;
293 278
         }
@@ -300,8 +285,7 @@  discard block
 block discarded – undo
300 285
      * @param mixed $variable
301 286
      * @return string|mixed
302 287
      */
303
-    public static function escapeOnce($variable)
304
-    {
288
+    public static function escapeOnce($variable) {
305 289
         if (!is_string($variable)) {
306 290
             return $variable;
307 291
         }
@@ -315,8 +299,7 @@  discard block
 block discarded – undo
315 299
      * @param mixed $value
316 300
      * @return mixed
317 301
      */
318
-    public static function defaultValue($variable, $value)
319
-    {
302
+    public static function defaultValue($variable, $value) {
320 303
         $isBlank = (is_string($variable) && $variable === '')
321 304
                     || is_bool($variable) && $variable === false
322 305
                     || $variable === null;
@@ -332,8 +315,7 @@  discard block
 block discarded – undo
332 315
      * @param mixed $glue
333 316
      * @return string|mixed
334 317
      */
335
-    public static function join($variable, $glue = ' ')
336
-    {
318
+    public static function join($variable, $glue = ' ') {
337 319
         if (!is_string($glue)) {
338 320
             return $variable;
339 321
         }
@@ -361,8 +343,7 @@  discard block
 block discarded – undo
361 343
      * @param mixed $variable
362 344
      * @return string|mixed
363 345
      */
364
-    public static function lower($variable)
365
-    {
346
+    public static function lower($variable) {
366 347
         if (!is_string($variable)) {
367 348
             return $variable;
368 349
         }
@@ -379,8 +360,7 @@  discard block
 block discarded – undo
379 360
      * @param mixed $variable
380 361
      * @return string|mixed
381 362
      */
382
-    public static function capitalize($variable)
383
-    {
363
+    public static function capitalize($variable) {
384 364
         if (!is_string($variable)) {
385 365
             return $variable;
386 366
         }
@@ -399,8 +379,7 @@  discard block
 block discarded – undo
399 379
      * @param mixed $variable
400 380
      * @return string|mixed
401 381
      */
402
-    public static function lstrip($variable)
403
-    {
382
+    public static function lstrip($variable) {
404 383
         if (!is_string($variable)) {
405 384
             return $variable;
406 385
         }
@@ -413,8 +392,7 @@  discard block
 block discarded – undo
413 392
      * @param mixed $variable
414 393
      * @return string|mixed
415 394
      */
416
-    public static function rstrip($variable)
417
-    {
395
+    public static function rstrip($variable) {
418 396
         if (!is_string($variable)) {
419 397
             return $variable;
420 398
         }
@@ -427,8 +405,7 @@  discard block
 block discarded – undo
427 405
      * @param mixed $variable
428 406
      * @return string|mixed
429 407
      */
430
-    public static function strip($variable)
431
-    {
408
+    public static function strip($variable) {
432 409
         if (!is_string($variable)) {
433 410
             return $variable;
434 411
         }
@@ -441,8 +418,7 @@  discard block
 block discarded – undo
441 418
      * @param mixed $variable
442 419
      * @return string|mixed
443 420
      */
444
-    public static function stripHtml($variable)
445
-    {
421
+    public static function stripHtml($variable) {
446 422
         if (!is_string($variable)) {
447 423
             return $variable;
448 424
         }
@@ -455,8 +431,7 @@  discard block
 block discarded – undo
455 431
      * @param mixed $variable
456 432
      * @return string|mixed
457 433
      */
458
-    public static function stripNewLine($variable)
459
-    {
434
+    public static function stripNewLine($variable) {
460 435
         if (!is_string($variable)) {
461 436
             return $variable;
462 437
         }
Please login to merge, or discard this patch.
src/Filter/HtmlFilter.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,16 +55,14 @@
 block discarded – undo
55 55
  * Class HtmlFilter
56 56
  * @package Platine\Template\Filter
57 57
  */
58
-class HtmlFilter extends AbstractFilter
59
-{
58
+class HtmlFilter extends AbstractFilter {
60 59
 
61 60
     /**
62 61
      * Put all letter to lower case
63 62
      * @param mixed $variable
64 63
      * @return string|mixed
65 64
      */
66
-    public static function nl2br($variable)
67
-    {
65
+    public static function nl2br($variable) {
68 66
         if (!is_string($variable)) {
69 67
             return $variable;
70 68
         }
Please login to merge, or discard this patch.
src/Filter/ArrayFilter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         } else {
121 121
             $first = reset($variable);
122 122
             if ($first !== false && is_array($first) && array_key_exists($property, $first)) {
123
-                uasort($variable, function ($a, $b) use ($property) {
123
+                uasort($variable, function($a, $b) use ($property) {
124 124
                     return $a[$property] <=> $b[$property];
125 125
                 });
126 126
             }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             return $variable;
175 175
         }
176 176
 
177
-        return array_map(function ($element) use ($property) {
177
+        return array_map(function($element) use ($property) {
178 178
             if (is_callable($element)) {
179 179
                 return $element();
180 180
             } elseif (is_array($element) && array_key_exists($property, $element)) {
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -57,16 +57,14 @@  discard block
 block discarded – undo
57 57
  * Class ArrayFilter
58 58
  * @package Platine\Template\Filter
59 59
  */
60
-class ArrayFilter extends AbstractFilter
61
-{
60
+class ArrayFilter extends AbstractFilter {
62 61
 
63 62
     /**
64 63
      * Returns the first element of an array
65 64
      * @param array<mixed>|Iterator<mixed>|mixed $value
66 65
      * @return mixed
67 66
      */
68
-    public static function first($value)
69
-    {
67
+    public static function first($value) {
70 68
         if (is_array($value)) {
71 69
             return reset($value);
72 70
         }
@@ -85,8 +83,7 @@  discard block
 block discarded – undo
85 83
      * @param array<mixed>|Traversable<mixed>|mixed $value
86 84
      * @return mixed
87 85
      */
88
-    public static function last($value)
89
-    {
86
+    public static function last($value) {
90 87
         if (is_array($value)) {
91 88
             return end($value);
92 89
         }
@@ -109,8 +106,7 @@  discard block
 block discarded – undo
109 106
      * @param mixed $property
110 107
      * @return mixed
111 108
      */
112
-    public static function sort($variable, $property = null)
113
-    {
109
+    public static function sort($variable, $property = null) {
114 110
         if ($variable instanceof Traversable) {
115 111
             $variable = iterator_to_array($variable);
116 112
         }
@@ -134,8 +130,7 @@  discard block
 block discarded – undo
134 130
      * @param array<int|string, mixed>|mixed $variable
135 131
      * @return mixed
136 132
      */
137
-    public static function sortKey($variable)
138
-    {
133
+    public static function sortKey($variable) {
139 134
         if (is_array($variable)) {
140 135
             ksort($variable);
141 136
             return $variable;
@@ -149,8 +144,7 @@  discard block
 block discarded – undo
149 144
      * @param array<int|string, mixed>|mixed $variable
150 145
      * @return mixed
151 146
      */
152
-    public static function unique($variable)
153
-    {
147
+    public static function unique($variable) {
154 148
         if ($variable instanceof Traversable) {
155 149
             $variable = iterator_to_array($variable);
156 150
         }
@@ -164,8 +158,7 @@  discard block
 block discarded – undo
164 158
      * @param mixed $property
165 159
      * @return string|mixed
166 160
      */
167
-    public static function map($variable, $property)
168
-    {
161
+    public static function map($variable, $property) {
169 162
         if ($variable instanceof Traversable) {
170 163
             $variable = iterator_to_array($variable);
171 164
         }
@@ -191,8 +184,7 @@  discard block
 block discarded – undo
191 184
      * @param array<mixed>|Traversable|mixed $variable
192 185
      * @return string|mixed
193 186
      */
194
-    public static function reverse($variable)
195
-    {
187
+    public static function reverse($variable) {
196 188
         if ($variable instanceof Traversable) {
197 189
             $variable = iterator_to_array($variable);
198 190
         }
Please login to merge, or discard this patch.
src/Filter/DatetimeFilter.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * Class DatetimeFilter
56 56
  * @package Platine\Template\Filter
57 57
  */
58
-class DatetimeFilter extends AbstractFilter
59
-{
58
+class DatetimeFilter extends AbstractFilter {
60 59
 
61 60
     /**
62 61
      * Formats a date using
@@ -64,8 +63,7 @@  discard block
 block discarded – undo
64 63
      * @param mixed $format
65 64
      * @return string|mixed
66 65
      */
67
-    public static function date($variable, $format)
68
-    {
66
+    public static function date($variable, $format) {
69 67
         if (!is_string($variable) || !is_string($format)) {
70 68
             return $variable;
71 69
         }
Please login to merge, or discard this patch.