Skip to content

Commit 7fb0c1f

Browse files
committed
fix
1 parent cd7fb2e commit 7fb0c1f

13 files changed

+71
-69
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"laravellux/html": "^7.1",
2525
"mockery/mockery": "^1.0",
2626
"nesbot/carbon": "^1.26.3 || ^2.0",
27-
"phpunit/phpunit": "^9.5",
27+
"phpunit/phpunit": "^11.5.3",
2828
"ramsey/uuid": "^3.9|^4.0"
2929
},
3030
"autoload": {

src/Artisan/Background.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* https://github.com/dmitry-ivanov/laravel-helper-functions.
45
*/

src/Artisan/SessionGarbageCollector.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright (c) $year.
45
* @author IT Can (Michiel Vugteveen) <[email protected]>

src/GlobalHelpersServiceProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static function ($sql, $binding) {
9494

9595
return preg_replace(
9696
'/\?/',
97-
is_string($binding) ? "'" . $binding . "'" : $binding,
97+
is_string($binding) ? "'".$binding."'" : $binding,
9898
$sql,
9999
1
100100
);
@@ -165,7 +165,7 @@ function () {
165165
}
166166
}, 200, [
167167
'Content-Type' => 'application/pdf',
168-
'Content-Disposition' => 'inline; filename="' . $fileName ?? basename($filePath) . '"',
168+
'Content-Disposition' => 'inline; filename="'.$fileName ?? basename($filePath).'"',
169169
]);
170170
});
171171
}

src/Helpers/CryptHelper.php

-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public static function encrypt($sourcePath, $destPath, $deleteSourceFile = false
2727
}
2828

2929
/**
30-
* @param $sourcePath
31-
* @param $destPath
3230
* @return bool
3331
*
3432
* @throws \Exception
@@ -41,7 +39,6 @@ public static function decrypt($sourcePath, $destPath = null)
4139
}
4240

4341
/**
44-
* @param $sourcePath
4542
* @return bool
4643
*
4744
* @throws \Exception

src/Helpers/FileEncrypter.php

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public function encrypt($sourcePath, $destPath)
119119
|| ($i + 1 == $numberOfChunks && $fileSize !== strlen($plaintext) + $chunkSize * $i)
120120
) {
121121
fseek($fpIn, $chunkSize * $i);
122+
122123
continue;
123124
}
124125

@@ -170,6 +171,7 @@ public function decrypt($sourcePath, $destPath)
170171
|| ($i + 1 == $numberOfChunks && $fileSize !== strlen($ciphertext) + $chunkSize * $i)
171172
) {
172173
fseek($fpIn, 16 + 16 * (self::FILE_ENCRYPTION_BLOCKS + 1) * $i);
174+
173175
continue;
174176
}
175177

src/Helpers/Macros/Trim.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* Copyright (c) $year.
45
* @author IT Can (Michiel Vugteveen) <[email protected]>

src/Middleware/ValidateJson.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public function handle($request, Closure $next)
3333

3434
json_decode($request->getContent());
3535

36-
if (JSON_ERROR_NONE !== json_last_error()) {
36+
if (json_last_error() !== JSON_ERROR_NONE) {
3737
throw new RuntimeException(
3838
'Unable to parse JSON data: '
39-
. json_last_error_msg()
39+
.json_last_error_msg()
4040
);
4141
}
4242

src/Providers/CarbonServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function boot(): void
4848

4949
// Loop through each method and define a macro
5050
foreach ($methods as $method) {
51-
$macro = 'int' . ucfirst($method);
51+
$macro = 'int'.ucfirst($method);
5252

5353
Carbon::macro($macro, function (...$args) use ($method) {
5454
return (int) abs(call_user_func_array([$this, $method], $args));

src/Response/PdfResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function __construct($content, $filename, $extraHeaders = [])
1010
{
1111
$headers = [
1212
'Content-Type' => 'application/pdf',
13-
'Content-Disposition' => 'inline; filename="' . $filename . '"',
13+
'Content-Disposition' => 'inline; filename="'.$filename.'"',
1414
];
1515

1616
if (is_array($extraHeaders)) {

src/helpers.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function cdnUrl($path = '')
3939
{
4040
$cdn = (config('settings.cdn')) ?: config('app.url', '/');
4141

42-
return rtrim($cdn, '/') . '/' . ltrim($path, '/');
42+
return rtrim($cdn, '/').'/'.ltrim($path, '/');
4343
}
4444
}
4545

@@ -78,7 +78,7 @@ function mixCDN($file)
7878
*/
7979
function uploadUrl($url)
8080
{
81-
return cdnUrl('uploads/' . ltrim($url, '/'));
81+
return cdnUrl('uploads/'.ltrim($url, '/'));
8282
}
8383
}
8484

@@ -91,7 +91,7 @@ function uploadUrl($url)
9191
*/
9292
function imgUrl($url)
9393
{
94-
return cdnUrl('img/' . ltrim($url, '/'));
94+
return cdnUrl('img/'.ltrim($url, '/'));
9595
}
9696
}
9797

@@ -286,7 +286,7 @@ function getHost($url, $subdomain = true)
286286
$url = trim($url);
287287

288288
if (stripos($url, '://') === false && substr($url, 0, 1) != '/') {
289-
$url = 'http://' . $url;
289+
$url = 'http://'.$url;
290290
}
291291

292292
$parsedUrl = parse_url($url);
@@ -295,20 +295,20 @@ function getHost($url, $subdomain = true)
295295
$host = array_pop($parts);
296296

297297
if (strlen($tld) === 2 && strlen($host) <= 3) {
298-
$tld = $host . '.' . $tld;
298+
$tld = $host.'.'.$tld;
299299
$host = array_pop($parts);
300300
}
301301

302302
$info = [
303303
'protocol' => $parsedUrl['scheme'],
304304
'subdomain' => implode('.', $parts),
305-
'domain' => $host . '.' . $tld,
305+
'domain' => $host.'.'.$tld,
306306
'host' => $host,
307307
'tld' => $tld,
308308
];
309309

310310
return ($subdomain && ! empty($info['subdomain']))
311-
? $info['subdomain'] . '.' . $info['domain']
311+
? $info['subdomain'].'.'.$info['domain']
312312
: $info['domain'];
313313
}
314314
}
@@ -342,11 +342,11 @@ function randomFilename($path, $ext, $name = null, $timestamp = true)
342342
$filename = Str::lower($filename);
343343

344344
if ($timestamp) {
345-
$filename .= '-' . time();
345+
$filename .= '-'.time();
346346
}
347347

348348
// Loop until file does not exists
349-
while (file_exists($path . '/' . $filename . '.' . $ext)) {
349+
while (file_exists($path.'/'.$filename.'.'.$ext)) {
350350
$filename .= rand(0, 99999);
351351
}
352352

@@ -578,7 +578,7 @@ function callBackground($command, $before = null, $after = null)
578578
*/
579579
function domainName($url, $withSubdomain = false)
580580
{
581-
$url = 'http://' . str_replace(['http://', 'https://'], '', $url);
581+
$url = 'http://'.str_replace(['http://', 'https://'], '', $url);
582582
$host = parse_url($url, PHP_URL_HOST);
583583

584584
$domain = new Domain($host);
@@ -646,9 +646,9 @@ function formatLicensePlate($plate)
646646
'/^(\d{3})([A-Z]{2})(\d{1})$/', // 14 999-XX-9 (since 2019)
647647

648648
// likely upcoming plate patterns
649-
//'^(\d{3})(\d{2})([A-Z]{1})$/', // 999-99-X
650-
//'^([A-Z]{3})(\d{2})(\d{1})$/', // XXX-99-9
651-
//'^([A-Z]{3})([A-Z]{2})(\d{1})$/', // XXX-XX-9
649+
// '^(\d{3})(\d{2})([A-Z]{1})$/', // 999-99-X
650+
// '^([A-Z]{3})(\d{2})(\d{1})$/', // XXX-99-9
651+
// '^([A-Z]{3})([A-Z]{2})(\d{1})$/', // XXX-XX-9
652652
];
653653

654654
$diplomateLicencePlateRegex = '/^CD[ABFJNST]\d{1,3}$/';
@@ -716,10 +716,10 @@ function compressHtmlPDF($html)
716716

717717
// remove ws around block/undisplayed elements
718718
$html = preg_replace('/\\s+(<\\/?(?:area|article|aside|base(?:font)?|blockquote|body'
719-
. '|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
720-
. '|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
721-
. '|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h|r|foot|itle)'
722-
. '|ul|video)\\b[^>]*>)/iu', '$1', $html);
719+
.'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
720+
.'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
721+
.'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h|r|foot|itle)'
722+
.'|ul|video)\\b[^>]*>)/iu', '$1', $html);
723723

724724
// remove ws outside of all elements
725725
$html = preg_replace(

0 commit comments

Comments
 (0)