@@ -269,7 +269,7 @@ |
||
269 | 269 | */ |
270 | 270 | public function getAmount(): float |
271 | 271 | { |
272 | - if ($this->part instanceof Part && ! $this->part->useFloatAmount()) { |
|
272 | + if ($this->part instanceof Part && !$this->part->useFloatAmount()) { |
|
273 | 273 | return round($this->amount); |
274 | 274 | } |
275 | 275 |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getPriceRelatedQuantity(): float |
182 | 182 | { |
183 | - if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) { |
|
183 | + if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) { |
|
184 | 184 | $tmp = round($this->price_related_quantity); |
185 | 185 | |
186 | 186 | return $tmp < 1 ? 1 : $tmp; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function getMinDiscountQuantity(): float |
205 | 205 | { |
206 | - if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) { |
|
206 | + if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) { |
|
207 | 207 | $tmp = round($this->min_discount_quantity); |
208 | 208 | |
209 | 209 | return $tmp < 1 ? 1 : $tmp; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function attachmentToFile(Attachment $attachment): ?SplFileInfo |
56 | 56 | { |
57 | - if ($attachment->isExternal() || ! $this->isFileExisting($attachment)) { |
|
57 | + if ($attachment->isExternal() || !$this->isFileExisting($attachment)) { |
|
58 | 58 | return null; |
59 | 59 | } |
60 | 60 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return null; |
129 | 129 | } |
130 | 130 | |
131 | - if (! $this->isFileExisting($attachment)) { |
|
131 | + if (!$this->isFileExisting($attachment)) { |
|
132 | 132 | return null; |
133 | 133 | } |
134 | 134 |
@@ -184,7 +184,7 @@ |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | //If the new string does not begin with a placeholder, it is invalid |
187 | - if (! preg_match('#^%\w+%#', $real_path)) { |
|
187 | + if (!preg_match('#^%\w+%#', $real_path)) { |
|
188 | 188 | return null; |
189 | 189 | } |
190 | 190 |
@@ -73,9 +73,9 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -129,7 +129,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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'; |
@@ -36,7 +36,7 @@ |
||
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 | } |
@@ -53,7 +53,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -316,7 +316,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |