Skip to content

Commit 428f317

Browse files
committed
Code quality improvements
1 parent 11dc744 commit 428f317

20 files changed

+77
-59
lines changed

Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function hasOption(int $key): bool
5353
{
5454
return (isset($this->options[$key]));
5555
}
56-
56+
5757
/**
5858
* Sends a PSR-7 request and returns a PSR-7 response.
5959
* @param RequestInterface $request
@@ -232,7 +232,7 @@ private function buildOptions(): void
232232
*/
233233
private function buildHeaders(RequestInterface $request): void
234234
{
235-
$data = array();
235+
$data = [];
236236
foreach ($request->getHeaders() as $name => $_unUsedVal) {
237237
$data[] = "{$name}: " . $request->getHeaderLine($name);
238238
}

Cookies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(
3535
$this->secure = $secure;
3636
$this->httpOnly = $httpOnly;
3737
}
38-
38+
3939
/**
4040
* Set cookie allowed path
4141
* @param string $path URI Path

Dir.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Dir implements DirInterface
1212
private $dir;
1313
private $getRootDir;
1414
private $handler;
15-
15+
1616

1717
public function __construct($dir, ?string $getRootDir = null)
1818
{

Env.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
class Env
1111
{
12-
private $fileData = array();
13-
private $data = array();
14-
private $set = array();
15-
private $drop = array();
12+
private $fileData = [];
13+
private $data = [];
14+
private $set = [];
15+
private $drop = [];
1616

1717
public function __construct(?string $file = null)
1818
{
@@ -65,7 +65,7 @@ public function generateOutput(array $fromArr = ["data", "fileData", "set"])
6565
{
6666
$out = "";
6767

68-
$data = array();
68+
$data = [];
6969
$validData = ["data", "fileData", "set"];
7070
foreach ($validData as $d) {
7171
if (in_array($d, $fromArr)) {

Environment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function has($key): bool
3636
{
3737
return (bool)($this->get($key, null));
3838
}
39-
39+
4040
/**
4141
* Return all env
4242
* @return array
@@ -52,7 +52,7 @@ public function fetch(): array
5252
*/
5353
public function getUriParts(array $add = []): array
5454
{
55-
$arr = array();
55+
$arr = [];
5656
$arr['scheme'] = ($this->get("HTTPS") === 'on') ? 'https' : 'http';
5757
$arr['user'] = $this->get("PHP_AUTH_USER");
5858
$arr['pass'] = $this->get("PHP_AUTH_PW");

Headers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Headers implements HeadersInterface
88
{
9-
protected $headers = array();
9+
protected $headers = [];
1010

1111
private static $getGlobalHeaders;
1212

@@ -110,7 +110,7 @@ final public static function getGlobalHeaders($skip = false): array
110110
if (!$skip && function_exists("getallheaders")) {
111111
static::$getGlobalHeaders = getallheaders();
112112
} else {
113-
static::$getGlobalHeaders = array();
113+
static::$getGlobalHeaders = [];
114114
foreach ($_SERVER as $key => $value) {
115115
if (substr($key, 0, 5) <> 'HTTP_') {
116116
continue;

Interfaces/CookiesInterface.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function sethttpOnly(bool $httpOnly): self;
3939
* @return self
4040
*/
4141
public function setSameSite(string $samesite): self;
42-
42+
4343
/**
4444
* Set cookie
4545
* @param string $name
@@ -56,12 +56,12 @@ public function set(string $name, string $value, int $expires, bool $force = fal
5656
*/
5757
public function has(string $name): bool;
5858

59-
/**
60-
* Get cookie
61-
* @param string $name
62-
* @param string|null $default
63-
* @return string|null
64-
*/
59+
/**
60+
* Get cookie
61+
* @param string $name
62+
* @param string|null $default
63+
* @return string|null
64+
*/
6565
public function get(string $name, ?string $default = null): ?string;
6666

6767
/**

Interfaces/DirHandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* DirHandlerInterface
44
* Is used to extend upon the Dir instance with more dir methods
55
*/
6+
67
namespace MaplePHP\Http\Interfaces;
78

89
interface DirHandlerInterface
910
{
10-
1111
}

Interfaces/MessageInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function withBody(StreamInterface $body);
161161
* But is used by the framework
162162
*
163163
*/
164-
164+
165165
/**
166166
* Get header value data items
167167
* @param string $name name/key (case insensitive)

Interfaces/ResponseInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getReasonPhrase();
7373
* But is used by the framework
7474
*
7575
*/
76-
76+
7777
/**
7878
* Clear cache. No exceptions!
7979
* Out of security reasons it is actually good practice to call this BY default on a framework

0 commit comments

Comments
 (0)