style: auto-fix 1340 phpcs PSR-12 violations via phpcbf; exclude MissingNamespace and SideEffects
This commit is contained in:
+13
-6
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UrlHelper - URL and domain utilities
|
||||
*
|
||||
* Provides secure URL generation with host validation.
|
||||
*/
|
||||
class UrlHelper {
|
||||
class UrlHelper
|
||||
{
|
||||
/**
|
||||
* Get the application base URL with validated host
|
||||
*
|
||||
@@ -13,7 +15,8 @@ class UrlHelper {
|
||||
*
|
||||
* @return string Base URL (e.g., "https://example.com")
|
||||
*/
|
||||
public static function getBaseUrl(): string {
|
||||
public static function getBaseUrl(): string
|
||||
{
|
||||
$protocol = self::getProtocol();
|
||||
$host = self::getValidatedHost();
|
||||
|
||||
@@ -25,7 +28,8 @@ class UrlHelper {
|
||||
*
|
||||
* @return string 'https' or 'http'
|
||||
*/
|
||||
public static function getProtocol(): string {
|
||||
public static function getProtocol(): string
|
||||
{
|
||||
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
||||
return 'https';
|
||||
}
|
||||
@@ -48,7 +52,8 @@ class UrlHelper {
|
||||
*
|
||||
* @return string Validated hostname
|
||||
*/
|
||||
public static function getValidatedHost(): string {
|
||||
public static function getValidatedHost(): string
|
||||
{
|
||||
$config = $GLOBALS['config'] ?? [];
|
||||
|
||||
// Use configured APP_DOMAIN if available
|
||||
@@ -84,7 +89,8 @@ class UrlHelper {
|
||||
* @param string $ticketId Ticket ID
|
||||
* @return string Full ticket URL
|
||||
*/
|
||||
public static function ticketUrl(string $ticketId): string {
|
||||
public static function ticketUrl(string $ticketId): string
|
||||
{
|
||||
return self::getBaseUrl() . '/ticket/' . urlencode($ticketId);
|
||||
}
|
||||
|
||||
@@ -93,7 +99,8 @@ class UrlHelper {
|
||||
*
|
||||
* @return bool True if HTTPS
|
||||
*/
|
||||
public static function isSecure(): bool {
|
||||
public static function isSecure(): bool
|
||||
{
|
||||
return self::getProtocol() === 'https';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user