Skip to content

Commit e15bc16

Browse files
committed
Use Uri facade instead of parse_url for host extraction
1 parent 221893f commit e15bc16

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/Utils/RepositoryUtils.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use CDash\Model\Project;
1111
use CDash\ServiceContainer;
1212
use Illuminate\Support\Facades\Log;
13+
use Illuminate\Support\Facades\Uri;
1314
use PDO;
1415

1516
class RepositoryUtils
@@ -27,7 +28,7 @@ public static function isGitHubUrl(string $url): bool
2728
}
2829
$enterpriseUrl = self::getEnterpriseUrl();
2930
if ($enterpriseUrl !== null) {
30-
$host = parse_url($enterpriseUrl, PHP_URL_HOST);
31+
$host = Uri::of($enterpriseUrl)->host();
3132
return is_string($host) && str_contains($url, $host);
3233
}
3334
return false;
@@ -167,7 +168,7 @@ public static function get_github_api_url($github_url): string
167168
{
168169
$enterpriseUrl = self::getEnterpriseUrl();
169170
if ($enterpriseUrl !== null) {
170-
$host = parse_url($enterpriseUrl, PHP_URL_HOST);
171+
$host = Uri::of($enterpriseUrl)->host();
171172
if (is_string($host)) {
172173
$idx = strpos($github_url, $host);
173174
if ($idx !== false) {

0 commit comments

Comments
 (0)