Passed
Push — master ( 7300a3...1a39d8 )
by Jan
05:00
created
src/Services/Attachments/FileTypeFilterTools.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
         //Check for each element if it is valid:
74 74
         foreach ($elements as $element) {
75 75
             $element = trim($element);
76
-            if (! preg_match('#^\.\w+$#', $element) // .ext is allowed
77
-                && ! preg_match('#^[-\w.]+\/[-\w.]+#', $element) //Explicit MIME type is allowed
78
-                && ! in_array($element, static::ALLOWED_MIME_PLACEHOLDERS, false)) { //image/* is allowed
76
+            if (!preg_match('#^\.\w+$#', $element) // .ext is allowed
77
+                && !preg_match('#^[-\w.]+\/[-\w.]+#', $element) //Explicit MIME type is allowed
78
+                && !in_array($element, static::ALLOWED_MIME_PLACEHOLDERS, false)) { //image/* is allowed
79 79
                 return false;
80 80
             }
81 81
         }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 $element = 'video/*';
122 122
             } elseif ('audio' === $element || 'audio/' === $element) {
123 123
                 $element = 'audio/*';
124
-            } elseif (! preg_match('#^[-\w.]+\/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) {
124
+            } elseif (!preg_match('#^[-\w.]+\/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) {
125 125
                 //Convert jpg to .jpg
126 126
                 $element = '.'.$element;
127 127
             }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $filter = trim($filter);
145 145
 
146
-        return $this->cache->get('filter_exts_'.md5($filter), function (ItemInterface $item) use ($filter) {
146
+        return $this->cache->get('filter_exts_'.md5($filter), function(ItemInterface $item) use ($filter) {
147 147
             $elements = explode(',', $filter);
148 148
             $extensions = [];
149 149
 
Please login to merge, or discard this patch.
src/Services/Attachments/AttachmentSubmitHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         }
130 130
 
131 131
         //Ensure the given attachment class is known to mapping
132
-        if (! isset($this->folder_mapping[get_class($attachment)])) {
132
+        if (!isset($this->folder_mapping[get_class($attachment)])) {
133 133
             throw new InvalidArgumentException('The given attachment class is not known! The passed class was: '.get_class($attachment));
134 134
         }
135 135
         //Ensure the attachment has an assigned element
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 
216 216
         //Determine the old filepath
217 217
         $old_path = $this->pathResolver->placeholderToRealPath($attachment->getPath());
218
-        if (! file_exists($old_path)) {
218
+        if (!file_exists($old_path)) {
219 219
             return $attachment;
220 220
         }
221 221
 
222 222
         $filename = basename($old_path);
223 223
         //If the basename is not one of the new unique on, we have to save the old filename
224
-        if (! preg_match('#\w+-\w{13}\.#', $filename)) {
224
+        if (!preg_match('#\w+-\w{13}\.#', $filename)) {
225 225
             //Save filename to attachment field
226 226
             $attachment->setFilename($attachment->getFilename());
227 227
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     protected function downloadURL(Attachment $attachment, array $options): Attachment
252 252
     {
253 253
         //Check if we are allowed to download files
254
-        if (! $this->allow_attachments_downloads) {
254
+        if (!$this->allow_attachments_downloads) {
255 255
             throw new RuntimeException('Download of attachments is not allowed!');
256 256
         }
257 257
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
             //Check if we have a extension given
303 303
             $pathinfo = pathinfo($filename);
304
-            if (! empty($pathinfo['extension'])) {
304
+            if (!empty($pathinfo['extension'])) {
305 305
                 $new_ext = $pathinfo['extension'];
306 306
             } else { //Otherwise we have to guess the extension for the new file, based on its content
307 307
                 $new_ext = $this->mimeTypes->getExtensions($this->mimeTypes->guessMimeType($tmp_path))[0] ?? 'tmp';
Please login to merge, or discard this patch.
src/Services/CustomEnvVarProcessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
             try {
37 37
                 $env = $getEnv($name);
38 38
 
39
-                return ! empty($env) && 'null://null' !== $env;
39
+                return !empty($env) && 'null://null' !== $env;
40 40
             } catch (EnvNotFoundException $envNotFoundException) {
41 41
                 return false;
42 42
             }
Please login to merge, or discard this patch.
src/Services/AmountFormatter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function format($value, ?MeasurementUnit $unit = null, array $options = [])
55 55
     {
56
-        if (! is_numeric($value)) {
56
+        if (!is_numeric($value)) {
57 57
             throw new InvalidArgumentException('$value must be an numeric value!');
58 58
         }
59 59
         $value = (float) $value;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         }
76 76
 
77 77
         //Otherwise just output it
78
-        if (! empty($options['unit'])) {
78
+        if (!empty($options['unit'])) {
79 79
             $format_string = '%.'.$options['decimals'].'f '.$options['unit'];
80 80
         } else { //Dont add space after number if no unit was specified
81 81
             $format_string = '%.'.$options['decimals'].'f';
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     protected function configureOptions(OptionsResolver $resolver): void
88 88
     {
89 89
         $resolver->setDefaults([
90
-            'show_prefix' => function (Options $options) {
90
+            'show_prefix' => function(Options $options) {
91 91
                 if (null !== $options['measurement_unit']) {
92 92
                     /** @var MeasurementUnit $unit */
93 93
                     $unit = $options['measurement_unit'];
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
                 return false;
99 99
             },
100
-            'is_integer' => function (Options $options) {
100
+            'is_integer' => function(Options $options) {
101 101
                 if (null !== $options['measurement_unit']) {
102 102
                     /** @var MeasurementUnit $unit */
103 103
                     $unit = $options['measurement_unit'];
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
                 return true;
109 109
             },
110
-            'unit' => function (Options $options) {
110
+            'unit' => function(Options $options) {
111 111
                 if (null !== $options['measurement_unit']) {
112 112
                     /** @var MeasurementUnit $unit */
113 113
                     $unit = $options['measurement_unit'];
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         $resolver->setAllowedTypes('decimals', 'int');
127 127
 
128
-        $resolver->setNormalizer('decimals', function (Options $options, $value) {
128
+        $resolver->setNormalizer('decimals', function(Options $options, $value) {
129 129
             // If the unit is integer based, then dont show any decimals
130 130
             if ($options['is_integer']) {
131 131
                 return 0;
Please login to merge, or discard this patch.
src/Entity/UserSystem/PermissionsEmbed.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function getBitValue(string $permission_name, int $bit_n): int
318 318
     {
319
-        if (! $this->isValidPermissionName($permission_name)) {
319
+        if (!$this->isValidPermissionName($permission_name)) {
320 320
             throw new InvalidArgumentException(sprintf('No permission with the name "%s" is existing!', $permission_name));
321 321
         }
322 322
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
      */
387 387
     public function setBitValue(string $permission_name, int $bit_n, int $new_value): self
388 388
     {
389
-        if (! $this->isValidPermissionName($permission_name)) {
389
+        if (!$this->isValidPermissionName($permission_name)) {
390 390
             throw new InvalidArgumentException('No permission with the given name is existing!');
391 391
         }
392 392
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      */
406 406
     public function getRawPermissionValue(string $permission_name): int
407 407
     {
408
-        if (! $this->isValidPermissionName($permission_name)) {
408
+        if (!$this->isValidPermissionName($permission_name)) {
409 409
             throw new InvalidArgumentException('No permission with the given name is existing!');
410 410
         }
411 411
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
      */
423 423
     public function setRawPermissionValue(string $permission_name, int $value): self
424 424
     {
425
-        if (! $this->isValidPermissionName($permission_name)) {
425
+        if (!$this->isValidPermissionName($permission_name)) {
426 426
             throw new InvalidArgumentException(sprintf('No permission with the given name %s is existing!', $permission_name));
427 427
         }
428 428
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
      */
443 443
     public function setRawPermissionValues(array $values, ?array $values2 = null): self
444 444
     {
445
-        if (! empty($values2)) {
445
+        if (!empty($values2)) {
446 446
             $values = array_combine($values, $values2);
447 447
         }
448 448
 
Please login to merge, or discard this patch.
src/Entity/Attachments/Attachment.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             return true;
176 176
         }
177 177
 
178
-        return ! in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
178
+        return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
179 179
     }
180 180
 
181 181
     /**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             return null;
227 227
         }
228 228
 
229
-        if (! empty($this->original_filename)) {
229
+        if (!empty($this->original_filename)) {
230 230
             return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION));
231 231
         }
232 232
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function getURL(): ?string
251 251
     {
252
-        if (! $this->isExternal() && ! $this->isBuiltIn()) {
252
+        if (!$this->isExternal() && !$this->isBuiltIn()) {
253 253
             return null;
254 254
         }
255 255
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     public function getHost(): ?string
264 264
     {
265
-        if (! $this->isExternal()) {
265
+        if (!$this->isExternal()) {
266 266
             return null;
267 267
         }
268 268
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         }
293 293
 
294 294
         //If we have a stored original filename, then use it
295
-        if (! empty($this->original_filename)) {
295
+        if (!empty($this->original_filename)) {
296 296
             return $this->original_filename;
297 297
         }
298 298
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     public function setElement(AttachmentContainingDBElement $element): self
369 369
     {
370
-        if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
370
+        if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
371 371
             throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
372 372
         }
373 373
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     public function setURL(?string $url): self
410 410
     {
411 411
         //Only set if the URL is not empty
412
-        if (! empty($url)) {
412
+        if (!empty($url)) {
413 413
             if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
414 414
                 throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
415 415
             }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         if ($only_http) {   //Check if scheme is HTTPS or HTTP
461 461
             $scheme = parse_url($string, PHP_URL_SCHEME);
462 462
             if ('http' !== $scheme && 'https' !== $scheme) {
463
-                return false;   //All other schemes are not valid.
463
+                return false; //All other schemes are not valid.
464 464
             }
465 465
         }
466 466
         if ($path_required) {
Please login to merge, or discard this patch.
src/DataTables/Column/LocaleDateTimeColumn.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     {
42 42
         if (null === $value) {
43 43
             return $this->options['nullValue'];
44
-        } elseif (! $value instanceof DateTimeInterface) {
44
+        } elseif (!$value instanceof DateTimeInterface) {
45 45
             $value = new DateTime((string) $value);
46 46
         }
47 47
 
Please login to merge, or discard this patch.
src/DataTables/Column/PartAttachmentsColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
 
61 61
     public function render($value, $context)
62 62
     {
63
-        if (! $context instanceof Part) {
63
+        if (!$context instanceof Part) {
64 64
             throw new RuntimeException('$context must be a Part object!');
65 65
         }
66 66
         $tmp = '';
67
-        $attachments = $context->getAttachments()->filter(function (Attachment $attachment) {
67
+        $attachments = $context->getAttachments()->filter(function(Attachment $attachment) {
68 68
             return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment);
69 69
         });
70 70
 
Please login to merge, or discard this patch.
src/Controller/AttachmentFileController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             throw new RuntimeException('You can not download external attachments!');
57 57
         }
58 58
 
59
-        if (! $helper->isFileExisting($attachment)) {
59
+        if (!$helper->isFileExisting($attachment)) {
60 60
             throw new RuntimeException('The file associated with the attachment is not existing!');
61 61
         }
62 62
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             throw new RuntimeException('You can not download external attachments!');
87 87
         }
88 88
 
89
-        if (! $helper->isFileExisting($attachment)) {
89
+        if (!$helper->isFileExisting($attachment)) {
90 90
             throw new RuntimeException('The file associated with the attachment is not existing!');
91 91
         }
92 92
 
Please login to merge, or discard this patch.