Passed
Push — main ( 09fd06...633b92 )
by Dimitri
03:33
created
src/Cli/Console/Console.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             foreach (Filesystem::allFiles($path) as $file) {
140 140
                 $name = str_replace([$path, '.' . $file->getExtension(), DS], ['', '', '\\'], $file->getPathname());
141 141
 
142
-                if (! Str::contains($name, 'Generators' . DS . 'Views')) {
142
+                if (!Str::contains($name, 'Generators' . DS . 'Views')) {
143 143
                     $this->addCommand('\BlitzPHP\Cli\Commands\\' . $name);
144 144
                 }
145 145
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function addCommand(string $commandName)
164 164
     {
165
-        if (! class_exists($commandName)) {
165
+        if (!class_exists($commandName)) {
166 166
             throw new CLIException("La classe `{$commandName}` n'existe pas");
167 167
         }
168 168
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
          */
172 172
         $instance = new $commandName($this, Services::logger());
173 173
 
174
-        if (! ($instance instanceof Command)) {
174
+        if (!($instance instanceof Command)) {
175 175
             throw CLIException::invalidCommand($commandName);
176 176
         }
177 177
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
             $value = (array) $value;
194 194
 
195 195
             $description = $value[0];
196
-            if (! is_string($description)) {
196
+            if (!is_string($description)) {
197 197
                 continue;
198 198
             }
199 199
 
200 200
             $default = $value[1] ?? null;
201 201
             $filter  = $value[2] ?? null;
202
-            if ($filter !== null && ! is_callable($filter)) {
202
+            if ($filter !== null && !is_callable($filter)) {
203 203
                 $filter = null;
204 204
             }
205 205
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $value = (array) $value;
212 212
 
213 213
             $description = $value[0];
214
-            if (! is_string($description)) {
214
+            if (!is_string($description)) {
215 215
                 continue;
216 216
             }
217 217
 
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
 
223 223
         $console = $this;
224 224
 
225
-        $command->action(function () use ($instance, $command, $console) {
226
-            if (! $console->suppress) {
225
+        $command->action(function() use ($instance, $command, $console) {
226
+            if (!$console->suppress) {
227 227
                 $console->start($instance->service);
228 228
             }
229 229
 
230 230
             $result = $instance->execute($command->values(false));
231 231
 
232
-            if (! $console->suppress) {
232
+            if (!$console->suppress) {
233 233
                 $console->end();
234 234
             }
235 235
 
Please login to merge, or discard this patch.
src/Cli/Console/GeneratorTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             // @codeCoverageIgnoreStart
95 95
             $this->colorize(lang('CLI.generator.usingCINamespace'), 'yellow');
96 96
 
97
-            if (! $this->confirm('Are you sure you want to continue?')) {
97
+            if (!$this->confirm('Are you sure you want to continue?')) {
98 98
                 $this->eol();
99 99
                 $this->colorize(lang('CLI.generator.cancelOperation'), 'yellow');
100 100
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         // Écraser des fichiers sans le savoir est une gêne sérieuse, nous allons donc vérifier si nous dupliquons des choses,
122 122
         // si l'option "forcer" n'est pas fournie, nous renvoyons.
123
-        if (! $this->getOption('force') && $isFile) {
123
+        if (!$this->getOption('force') && $isFile) {
124 124
             $this->io->error(lang('CLI.generator.fileExist', [clean_path($path)]), true);
125 125
 
126 126
             return;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // Vérifie si le répertoire pour enregistrer le fichier existe.
130 130
         $dir = dirname($path);
131 131
 
132
-        if (! is_dir($dir)) {
132
+        if (!is_dir($dir)) {
133 133
             mkdir($dir, 0755, true);
134 134
         }
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         // Construisez la classe en fonction des détails dont nous disposons.
139 139
         // Nous obtiendrons le contenu de notre fichier à partir du modèle,
140 140
         // puis nous effectuerons les remplacements nécessaires.
141
-        if (! write_file($path, $this->buildContent($class))) {
141
+        if (!write_file($path, $this->buildContent($class))) {
142 142
             // @codeCoverageIgnoreStart
143 143
             $this->io->error(lang('CLI.generator.fileError', [clean_path($path)]), true);
144 144
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             $class = $matches[1] . ucfirst($matches[2]);
203 203
         }
204 204
 
205
-        if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, $component)) {
205
+        if ($this->enabledSuffixing && $this->getOption('suffix') && !strripos($class, $component)) {
206 206
             $class .= ucfirst($component);
207 207
         }
208 208
 
Please login to merge, or discard this patch.
src/Traits/SingletonTrait.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     public static function instance()
39 39
     {
40
-        if (! (static::$_instance instanceof static)) {
40
+        if (!(static::$_instance instanceof static)) {
41 41
             $params            = func_get_args();
42 42
             static::$_instance = new static(...$params);
43 43
         }
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
 
34 34
     /**
35 35
      * Vérifie, instancie et renvoie la seule instance de la classe appelée.
36
-	 *
37
-	 * @return static
36
+     *
37
+     * @return static
38 38
      */
39 39
     public static function instance()
40 40
     {
Please login to merge, or discard this patch.
src/Constants/constants.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -80,49 +80,49 @@  discard block
 block discarded – undo
80 80
  */
81 81
 defined('LAYOUT_PATH') || define('LAYOUT_PATH', VIEW_PATH . 'layouts' . DS);
82 82
 
83
-if (! defined('SERVICE_PATH')) {
83
+if (!defined('SERVICE_PATH')) {
84 84
     /**
85 85
      * Services directory path
86 86
      */
87 87
     define('SERVICE_PATH', APP_PATH . 'services' . DS);
88 88
 }
89 89
 
90
-if (! defined('LOG_PATH')) {
90
+if (!defined('LOG_PATH')) {
91 91
     /**
92 92
      * Application logs files storage path
93 93
      */
94 94
     define('LOG_PATH', STORAGE_PATH . 'logs' . DS);
95 95
 }
96 96
 
97
-if (! defined('DATABASE_PATH')) {
97
+if (!defined('DATABASE_PATH')) {
98 98
     /**
99 99
      * Database storage directory path
100 100
      */
101 101
     define('DATABASE_PATH', STORAGE_PATH . 'database' . DS);
102 102
 }
103 103
 
104
-if (! defined('DB_MIGRATION_PATH')) {
104
+if (!defined('DB_MIGRATION_PATH')) {
105 105
     /**
106 106
      * Database migrations storage path
107 107
      */
108 108
     define('DB_MIGRATION_PATH', RESOURCE_PATH . 'database' . DS . 'migrations' . DS);
109 109
 }
110 110
 
111
-if (! defined('DB_SEED_PATH')) {
111
+if (!defined('DB_SEED_PATH')) {
112 112
     /**
113 113
      * Database seeds storage path
114 114
      */
115 115
     define('DB_SEED_PATH', RESOURCE_PATH . 'database' . DS . 'seeds' . DS);
116 116
 }
117 117
 
118
-if (! defined('DB_DUMP_PATH')) {
118
+if (!defined('DB_DUMP_PATH')) {
119 119
     /**
120 120
      * Database backup storage path
121 121
      */
122 122
     define('DB_DUMP_PATH', DATABASE_PATH . 'dump' . DS);
123 123
 }
124 124
 
125
-if (! defined('DB_CACHE_PATH')) {
125
+if (!defined('DB_CACHE_PATH')) {
126 126
     /**
127 127
      * Database cache directory path
128 128
      */
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
  */
145 145
 defined('SECOND') || define('SECOND', 1);
146 146
 defined('MINUTE') || define('MINUTE', 60);
147
-defined('HOUR')   || define('HOUR', 3600);
148
-defined('DAY')    || define('DAY', 86400);
149
-defined('WEEK')   || define('WEEK', 604800);
150
-defined('MONTH')  || define('MONTH', 2592000);
151
-defined('YEAR')   || define('YEAR', 31536000);
147
+defined('HOUR') || define('HOUR', 3600);
148
+defined('DAY') || define('DAY', 86400);
149
+defined('WEEK') || define('WEEK', 604800);
150
+defined('MONTH') || define('MONTH', 2592000);
151
+defined('YEAR') || define('YEAR', 31536000);
152 152
 defined('DECADE') || define('DECADE', 315360000);
153 153
 
154 154
 /**
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
  * - BSD sysexits.h: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
170 170
  * - Bash scripting: http://tldp.org/LDP/abs/html/exitcodes.html
171 171
  */
172
-defined('EXIT_SUCCESS')        || define('EXIT_SUCCESS', 0); // pas d'erreurs
173
-defined('EXIT_ERROR')          || define('EXIT_ERROR', 1); // erreur generique
174
-defined('EXIT_CONFIG')         || define('EXIT_CONFIG', 3); // erreur de configuration
175
-defined('EXIT_UNKNOWN_FILE')   || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé
176
-defined('EXIT_UNKNOWN_CLASS')  || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue
172
+defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs
173
+defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique
174
+defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration
175
+defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé
176
+defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue
177 177
 defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // membre de classe inconnu
178
-defined('EXIT_USER_INPUT')     || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide
179
-defined('EXIT_DATABASE')       || define('EXIT_DATABASE', 8); // erreur de base de données
180
-defined('EXIT__AUTO_MIN')      || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas
181
-defined('EXIT__AUTO_MAX')      || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé
178
+defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide
179
+defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données
180
+defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas
181
+defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé
Please login to merge, or discard this patch.
src/Utilities/Helpers.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     {
26 26
         static $_is_php;
27 27
 
28
-        if (! isset($_is_php[$version])) {
28
+        if (!isset($_is_php[$version])) {
29 29
             $_is_php[$version] = version_compare(PHP_VERSION, $version, '>=');
30 30
         }
31 31
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
         $host = explode(':', $_SERVER['HTTP_HOST'] ?? '')[0];
41 41
 
42 42
         return
43
-            ! empty($host) // Si c'est vide, ca veut certainement dire qu'on est en CLI, or le CLI << n'est pas >> utilisé en ligne
44
-            && ! in_array($host, ['localhost', '127.0.0.1'], true)
45
-            && ! preg_match('#\.dev$#', $host)
46
-            && ! preg_match('#\.test$#', $host)
47
-            && ! preg_match('#\.lab$#', $host)
48
-            && ! preg_match('#\.loc(al)?$#', $host)
49
-            && ! preg_match('#^192\.168#', $host);
43
+            !empty($host) // Si c'est vide, ca veut certainement dire qu'on est en CLI, or le CLI << n'est pas >> utilisé en ligne
44
+            && !in_array($host, ['localhost', '127.0.0.1'], true)
45
+            && !preg_match('#\.dev$#', $host)
46
+            && !preg_match('#\.test$#', $host)
47
+            && !preg_match('#\.lab$#', $host)
48
+            && !preg_match('#\.loc(al)?$#', $host)
49
+            && !preg_match('#^192\.168#', $host);
50 50
     }
51 51
 
52 52
     /**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     public static function isReallyWritable(string $file): bool
65 65
     {
66 66
         // If we're on a Unix server with safe_mode off we call is_writable
67
-        if (DIRECTORY_SEPARATOR === '/' || ! ini_get('safe_mode')) {
67
+        if (DIRECTORY_SEPARATOR === '/' || !ini_get('safe_mode')) {
68 68
             return is_writable($file);
69 69
         }
70 70
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
             return true;
85 85
         }
86
-        if (! is_file($file) || ($fp = @fopen($file, 'ab')) === false) {
86
+        if (!is_file($file) || ($fp = @fopen($file, 'ab')) === false) {
87 87
             return false;
88 88
         }
89 89
 
@@ -97,23 +97,23 @@  discard block
 block discarded – undo
97 97
         $path  = parse_url($url);
98 98
         $query = '';
99 99
 
100
-        if (! empty($path['host'])) {
100
+        if (!empty($path['host'])) {
101 101
             $r = $path['scheme'] . '://';
102
-            if (! empty($path['user'])) {
102
+            if (!empty($path['user'])) {
103 103
                 $r .= $path['user'];
104
-                if (! empty($path['pass'])) {
104
+                if (!empty($path['pass'])) {
105 105
                     $r .= ':' . $path['pass'] . '@';
106 106
                 }
107 107
                 $r .= '@';
108 108
             }
109
-            if (! empty($path['host'])) {
109
+            if (!empty($path['host'])) {
110 110
                 $r .= $path['host'];
111 111
             }
112
-            if (! empty($path['port'])) {
112
+            if (!empty($path['port'])) {
113 113
                 $r .= ':' . $path['port'];
114 114
             }
115 115
             $url = $r . $path['path'];
116
-            if (! empty($path['query'])) {
116
+            if (!empty($path['query'])) {
117 117
                 $query = '?' . $path['query'];
118 118
             }
119 119
         }
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
         $non_displayables = [];
138 138
 
139 139
         if ($url_encoded) {
140
-            $non_displayables[] = '/%0[0-8bcef]/i';	// url encoded 00-08, 11, 12, 14, 15
141
-            $non_displayables[] = '/%1[0-9a-f]/i';	// url encoded 16-31
142
-            $non_displayables[] = '/%7f/i';	// url encoded 127
140
+            $non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15
141
+            $non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31
142
+            $non_displayables[] = '/%7f/i'; // url encoded 127
143 143
         }
144 144
 
145
-        $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S';	// 00-08, 11, 12, 14-31, 127
145
+        $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
146 146
 
147 147
         do {
148 148
             $str = preg_replace($non_displayables, '', $str, -1, $count);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 return $data;
186 186
             }
187 187
 
188
-            if (! in_array($context, ['html', 'js', 'css', 'url', 'attr'], true)) {
188
+            if (!in_array($context, ['html', 'js', 'css', 'url', 'attr'], true)) {
189 189
                 throw new InvalidArgumentException('Invalid escape context provided.');
190 190
             }
191 191
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             }
197 197
 
198 198
             static $escaper;
199
-            if (! $escaper) {
199
+            if (!$escaper) {
200 200
                 $escaper = new \Laminas\Escaper\Escaper($encoding);
201 201
             }
202 202
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             $double  = true;
262 262
         }
263 263
 
264
-        return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double);
264
+        return htmlspecialchars($text, ENT_QUOTES|ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double);
265 265
     }
266 266
 
267 267
     /**
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
             $server_addr = $_SERVER['HTTP_HOST'] ?? ((strpos($_SERVER['SERVER_ADDR'], ':') !== false) ? '[' . $_SERVER['SERVER_ADDR'] . ']' : $_SERVER['SERVER_ADDR']);
425 425
 
426 426
             if (isset($_SERVER['SERVER_PORT'])) {
427
-                $server_addr .= ':' . ((! preg_match('#:' . $_SERVER['SERVER_PORT'] . '$#', $server_addr)) ? $_SERVER['SERVER_PORT'] : '80');
427
+                $server_addr .= ':' . ((!preg_match('#:' . $_SERVER['SERVER_PORT'] . '$#', $server_addr)) ? $_SERVER['SERVER_PORT'] : '80');
428 428
             }
429 429
 
430 430
             if (
431
-                (! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
431
+                (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
432 432
                 || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
433
-                || (! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
433
+                || (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
434 434
             ) {
435 435
                 $base_url = 'https';
436 436
             } else {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      */
479 479
     public static function deprecationWarning(string $message, int $stackFrame = 1)
480 480
     {
481
-        if (! (error_reporting() & E_USER_DEPRECATED)) {
481
+        if (!(error_reporting() & E_USER_DEPRECATED)) {
482 482
             return;
483 483
         }
484 484
 
Please login to merge, or discard this patch.
src/Utilities/Str.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use InvalidArgumentException;
16 16
 use Transliterator;
17 17
 
18
-if (! defined('MB_ENABLED')) {
18
+if (!defined('MB_ENABLED')) {
19 19
     if (extension_loaded('mbstring')) {
20 20
         define('MB_ENABLED', true);
21 21
         // mbstring.internal_encoding est obsolète à partir de PHP 5.6
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         define('MB_ENABLED', false);
29 29
     }
30 30
 }
31
-if (! defined('ICONV_ENABLED')) {
31
+if (!defined('ICONV_ENABLED')) {
32 32
     if (extension_loaded('iconv')) {
33 33
         define('ICONV_ENABLED', true);
34 34
         // iconv.internal_encoding est obsolète à partir de PHP 5.6
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $converter = preg_replace('#Case$#i', '', $converter);
108 108
         $converter = str_replace('to', '', strtolower($converter));
109 109
 
110
-        if (! in_array($converter, $available_case, true)) {
110
+        if (!in_array($converter, $available_case, true)) {
111 111
             throw new InvalidArgumentException("Invalid converter type: `{$converter}`");
112 112
         }
113 113
 
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
     public static function cleanInsert(string $str, array $options): string
161 161
     {
162 162
         $clean = $options['clean'];
163
-        if (! $clean) {
163
+        if (!$clean) {
164 164
             return $str;
165 165
         }
166 166
         if ($clean === true) {
167 167
             $clean = ['method' => 'text'];
168 168
         }
169
-        if (! is_array($clean)) {
169
+        if (!is_array($clean)) {
170 170
             $clean = ['method' => $options['clean']];
171 171
         }
172 172
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     public static function containsAll(string $haystack, array $needles): bool
260 260
     {
261 261
         foreach ($needles as $needle) {
262
-            if (! static::contains($haystack, $needle)) {
262
+            if (!static::contains($haystack, $needle)) {
263 263
                 return false;
264 264
             }
265 265
         }
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
             return $options['clean'] ? static::cleanInsert($str, $options) : $str;
460 460
         }
461 461
 
462
-        if (! isset($format)) {
462
+        if (!isset($format)) {
463 463
             $format = sprintf(
464 464
                 '/(?<!%s)%s%%s%s/',
465 465
                 preg_quote($options['escape'], '/'),
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
             $str      = str_replace($tmpHash, $tmpValue, $str);
497 497
         }
498 498
 
499
-        if (! isset($options['format']) && isset($options['before'])) {
499
+        if (!isset($options['format']) && isset($options['before'])) {
500 500
             $str = str_replace($options['escape'] . $options['before'], $options['before'], $str);
501 501
         }
502 502
 
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
         $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
798 798
         $replace = preg_replace_callback(
799 799
             $pattern,
800
-            static function ($match) use ($strlen) {
801
-                $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
800
+            static function($match) use ($strlen) {
801
+                $utf8 = html_entity_decode($match[0], ENT_HTML5|ENT_QUOTES, 'UTF-8');
802 802
 
803 803
                 return str_repeat(' ', $strlen($utf8, 'UTF-8'));
804 804
             },
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
         $result      = '';
859 859
 
860 860
         $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
861
-        $parts   = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
861
+        $parts   = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
862 862
 
863 863
         foreach ($parts as $part) {
864 864
             $offset = 0;
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
             if ($offset !== 0 || $totalLength + $len > $length) {
880 880
                 if (
881 881
                     strpos($part, '&') === 0 && preg_match($pattern, $part)
882
-                    && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')
882
+                    && $part !== html_entity_decode($part, ENT_HTML5|ENT_QUOTES, 'UTF-8')
883 883
                 ) {
884 884
                     // Entities cannot be passed substr.
885 885
                     continue;
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
         }
935 935
 
936 936
         $truncate = mb_substr($text, mb_strlen($text) - $length + mb_strlen($ellipsis));
937
-        if (! $exact) {
937
+        if (!$exact) {
938 938
             $spacepos = mb_strpos($truncate, ' ');
939 939
             $truncate = $spacepos === false ? '' : trim(mb_substr($truncate, $spacepos));
940 940
         }
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
             }
990 990
             if ($tmpOffset !== -1) {
991 991
                 $buffer .= substr($data, $offset, ($tmpOffset - $offset));
992
-                if (! $depth && $data[$tmpOffset] === $separator) {
992
+                if (!$depth && $data[$tmpOffset] === $separator) {
993 993
                     $results[] = $buffer;
994 994
                     $buffer    = '';
995 995
                 } else {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
                     }
1005 1005
                 } else {
1006 1006
                     if ($data[$tmpOffset] === $leftBound) {
1007
-                        if (! $open) {
1007
+                        if (!$open) {
1008 1008
                             $depth++;
1009 1009
                             $open = true;
1010 1010
                         } else {
@@ -1018,11 +1018,11 @@  discard block
 block discarded – undo
1018 1018
                 $offset    = $length + 1;
1019 1019
             }
1020 1020
         }
1021
-        if (empty($results) && ! empty($buffer)) {
1021
+        if (empty($results) && !empty($buffer)) {
1022 1022
             $results[] = $buffer;
1023 1023
         }
1024 1024
 
1025
-        if (! empty($results)) {
1025
+        if (!empty($results)) {
1026 1026
             return array_map('trim', $results);
1027 1027
         }
1028 1028
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
      */
1063 1063
     public static function transliterate(string $string, $transliterator = null)
1064 1064
     {
1065
-        if (! $transliterator) {
1065
+        if (!$transliterator) {
1066 1066
             $transliterator = static::$_defaultTransliterator ?: static::$_defaultTransliteratorId;
1067 1067
         }
1068 1068
 
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
         $default = [
1094 1094
             'ellipsis' => '...', 'exact' => true, 'html' => false, 'trimWidth' => false,
1095 1095
         ];
1096
-        if (! empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') {
1096
+        if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') {
1097 1097
             $default['ellipsis'] = "\xe2\x80\xa6";
1098 1098
         }
1099 1099
         $options += $default;
@@ -1113,12 +1113,12 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
             foreach ($tags as $tag) {
1115 1115
                 $contentLength = 0;
1116
-                if (! in_array($tag[2], static::$_defaultHtmlNoCount, true)) {
1116
+                if (!in_array($tag[2], static::$_defaultHtmlNoCount, true)) {
1117 1117
                     $contentLength = self::strlen($tag[3], $options);
1118 1118
                 }
1119 1119
 
1120 1120
                 if ($truncate === '') {
1121
-                    if (! preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
1121
+                    if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
1122 1122
                         if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
1123 1123
                             array_unshift($openTags, $tag[2]);
1124 1124
                         } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
@@ -1164,13 +1164,13 @@  discard block
 block discarded – undo
1164 1164
 
1165 1165
         $result = self::substr($text, 0, $length - $ellipsisLength, $options);
1166 1166
 
1167
-        if (! $options['exact']) {
1167
+        if (!$options['exact']) {
1168 1168
             if (self::substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
1169 1169
                 $result = self::removeLastWord($result);
1170 1170
             }
1171 1171
 
1172 1172
             // If result is empty, then we don't need to count ellipsis in the cut.
1173
-            if (! strlen($result)) {
1173
+            if (!strlen($result)) {
1174 1174
                 $result = self::substr($text, 0, $length, $options);
1175 1175
             }
1176 1176
         }
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
     {
1202 1202
         preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $value, $matches);
1203 1203
 
1204
-        if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) {
1204
+        if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) {
1205 1205
             return $value;
1206 1206
         }
1207 1207
 
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
     {
1352 1352
         static $languageSpecific;
1353 1353
 
1354
-        if (! isset($languageSpecific)) {
1354
+        if (!isset($languageSpecific)) {
1355 1355
             $languageSpecific = [
1356 1356
                 'bg' => [
1357 1357
                     ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'],
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
                     ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'],
1363 1363
                 ],
1364 1364
                 'de' => [
1365
-                    ['ä',  'ö',  'ü',  'Ä',  'Ö',  'Ü'],
1365
+                    ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'],
1366 1366
                     ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
1367 1367
                 ],
1368 1368
                 'he' => [
Please login to merge, or discard this patch.
src/Utilities/Inflector.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
         '/us$/i'                                                             => 'uses',
46 46
         '/(alias)$/i'                                                        => '\1es',
47 47
         '/(ax|cris|test)is$/i'                                               => '\1es',
48
-        '/(m)an$/'                                                           => '\1en',        // man, woman, spokesman
49
-        '/(bu|campu)s$/'                                                     => '\1\2ses',     // bus, campus
50
-        '/(octop)us$/'                                                       => '\1i',         // octopus
48
+        '/(m)an$/'                                                           => '\1en', // man, woman, spokesman
49
+        '/(bu|campu)s$/'                                                     => '\1\2ses', // bus, campus
50
+        '/(octop)us$/'                                                       => '\1i', // octopus
51 51
         '/s$/'                                                               => 's',
52 52
         '/^$/'                                                               => '',
53 53
         '/$/'                                                                => 's',
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
             return $value;
434 434
         }
435
-        if (! isset(static::$_cache[$type][$key])) {
435
+        if (!isset(static::$_cache[$type][$key])) {
436 436
             return false;
437 437
         }
438 438
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             return static::$_cache['pluralize'][$word];
513 513
         }
514 514
 
515
-        if (! isset(static::$_cache['irregular']['pluralize'])) {
515
+        if (!isset(static::$_cache['irregular']['pluralize'])) {
516 516
             static::$_cache['irregular']['pluralize'] = '(?:' . implode('|', array_keys(static::$_irregular)) . ')';
517 517
         }
518 518
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             return static::$_cache['pluralize'][$word];
524 524
         }
525 525
 
526
-        if (! isset(static::$_cache['uninflected'])) {
526
+        if (!isset(static::$_cache['uninflected'])) {
527 527
             static::$_cache['uninflected'] = '(?:' . implode('|', static::$_uninflected) . ')';
528 528
         }
529 529
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
             return static::$_cache['singularize'][$word];
558 558
         }
559 559
 
560
-        if (! isset(static::$_cache['irregular']['singular'])) {
560
+        if (!isset(static::$_cache['irregular']['singular'])) {
561 561
             static::$_cache['irregular']['singular'] = '(?:' . implode('|', static::$_irregular) . ')';
562 562
         }
563 563
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
             return static::$_cache['singularize'][$word];
569 569
         }
570 570
 
571
-        if (! isset(static::$_cache['uninflected'])) {
571
+        if (!isset(static::$_cache['uninflected'])) {
572 572
             static::$_cache['uninflected'] = '(?:' . implode('|', static::$_uninflected) . ')';
573 573
         }
574 574
 
Please login to merge, or discard this patch.