Skip to content

Commit d9d1a72

Browse files
committed
Code refactoring; Rename method args, etc
1 parent 7a60487 commit d9d1a72

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Http.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ class Http
7575
/**
7676
* Give the HTTP status code name (e.g. "204 No Content").
7777
*
78-
* @param int $iStatus The "code" for the HTTP status.
78+
* @param int $status The "code" for the HTTP status.
7979
*
80-
* @return string|bool $iStatus Returns the "HTTP status code" if found, FALSE otherwise.
80+
* @return string|bool $status Returns the "HTTP status code" if found, FALSE otherwise.
8181
*/
82-
public static function getStatusCode(int $iStatus): string|bool
82+
public static function getStatusCode(int $status): string|bool
8383
{
84-
return !empty(static::STATUS_CODE[$iStatus]) ? static::STATUS_CODE[$iStatus] : false;
84+
return !empty(static::STATUS_CODE[$status]) ? static::STATUS_CODE[$status] : false;
8585
}
8686

8787
/**
@@ -95,37 +95,37 @@ public static function getHeadersList(): array
9595
/**
9696
* Set one or multiple headers.
9797
*
98-
* @param string|array $mHeaders Headers to send.
98+
* @param string|array $headers Headers to send.
9999
*
100100
* @throws Exception
101101
*/
102-
public static function setHeaders(string|array $mHeaders): void
102+
public static function setHeaders(string|array $headers): void
103103
{
104104
// Header already sent
105105
if (static::isSent()) {
106106
throw new Exception('Headers were already sent.');
107107
}
108108

109109
// Loop elements and set header
110-
foreach ((array)$mHeaders as $sHeader) {
110+
foreach ((array)$headers as $sHeader) {
111111
header((string)$sHeader);
112112
}
113113
}
114114

115115
/**
116116
* Parse headers for a given status code.
117117
*
118-
* @param int $iCode The code to use, possible values are: 200, 301, 302, 304, 307, 400, 401, 403, 404, 410, 500, 501, ...
118+
* @param int $code The code to use, possible values are: 200, 301, 302, 304, 307, 400, 401, 403, 404, 410, 500, 501, ...
119119
*
120120
* @throws Exception
121121
*/
122-
public static function setHeadersByCode(int $iCode = StatusCode::OK): void
122+
public static function setHeadersByCode(int $code = StatusCode::OK): void
123123
{
124-
if (!static::getStatusCode($iCode)) {
125-
$iCode = StatusCode::OK;
124+
if (!static::getStatusCode($code)) {
125+
$code = StatusCode::OK;
126126
}
127127

128-
static::setHeaders(static::getProtocol() . ' ' . static::getStatusCode($iCode));
128+
static::setHeaders(static::getProtocol() . ' ' . static::getStatusCode($code));
129129
}
130130

131131
/**
@@ -143,12 +143,12 @@ public static function setContentType(string $sType): void
143143
/**
144144
* Set the HTTP status code for the maintenance page.
145145
*
146-
* @param int $iMaintenanceTime Time site will be down for (in seconds).
146+
* @param int $maintenanceTimeSeconds Time site will be down for (in seconds).
147147
*/
148-
public static function setMaintenanceCode(int $iMaintenanceTime): void
148+
public static function setMaintenanceCode(int $maintenanceTimeSeconds): void
149149
{
150150
header(static::getProtocol() . ' 503 Service Temporarily Unavailable');
151-
header('Retry-After: ' . $iMaintenanceTime);
151+
header('Retry-After: ' . $maintenanceTimeSeconds);
152152
}
153153

154154

0 commit comments

Comments
 (0)