Skip to content

Commit 88b711e

Browse files
committed
Fixed codestyle
1 parent 235c4e6 commit 88b711e

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

src/Driver/Auto.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function multiRequest(array $requestList): array
4848
*/
4949
protected static function getClient(): AbstractDriver
5050
{
51-
if (class_exists(Client::class) && method_exists(Client::class, 'request')) {
51+
if (\class_exists(Client::class) && \method_exists(Client::class, 'request')) {
5252
return new Guzzle();
5353
}
5454

src/Driver/Guzzle.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function request(Request $request): Response
3636
{
3737
$client = new Client();
3838

39-
$start = microtime(true);
39+
$start = \microtime(true);
4040

4141
$httpResult = $client->request(
4242
$request->getMethod(),
@@ -54,7 +54,7 @@ public function request(Request $request): Response
5454
->setHeaders($httpResult->getHeaders())
5555
->setBody($httpResult->getBody()->getContents())
5656
->setRequest($request)
57-
->setTime(microtime(true) - $start);
57+
->setTime(\microtime(true) - $start);
5858
}
5959

6060
/**
@@ -106,7 +106,7 @@ private static function getDriverOptions(Options $options, array $headers, strin
106106
$body = $formParams = null;
107107

108108
if (Request::GET !== $method) {
109-
if (is_array($args)) {
109+
if (\is_array($args)) {
110110
$formParams = $args;
111111
} else {
112112
$body = $args;

src/Exception.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($message = '', $code = 0, \Throwable $previous = nul
3535
{
3636
parent::__construct($message, $code, $previous);
3737

38-
if (class_exists(EventManager::class) && $eManager = EventManager::getDefault()) {
38+
if (\class_exists(EventManager::class) && $eManager = EventManager::getDefault()) {
3939
$eManager->trigger('jbzoo.http.exception', [$this]);
4040
}
4141
}

src/HttpClient.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function request(
7272
->setUrl($url)
7373
->setArgs($args)
7474
->setMethod($method)
75-
->setOptions(array_merge($this->options->toArray(), $options));
75+
->setOptions(\array_merge($this->options->toArray(), $options));
7676

77-
$startTime = microtime(true);
77+
$startTime = \microtime(true);
7878

7979
try {
8080
$this->trigger('request.before', [$this->lastRequest]);
@@ -93,7 +93,7 @@ public function request(
9393
}
9494

9595
if (null === $response->time) {
96-
$response->setTime(microtime(true) - $startTime);
96+
$response->setTime(\microtime(true) - $startTime);
9797
}
9898

9999
$this->lastResponse = $response;
@@ -112,7 +112,7 @@ public function multiRequest(array $requestList, array $options = []): array
112112
$cleanedRequestList = [];
113113

114114
foreach ($requestList as $name => $requestData) {
115-
$requestOptions = array_merge($this->options->toArray(), $options, (array)($requestData[3] ?? []));
115+
$requestOptions = \array_merge($this->options->toArray(), $options, (array)($requestData[3] ?? []));
116116

117117
$cleanedRequestList[$name] = (new Request())
118118
->setUrl($requestData[0] ?? '')
@@ -141,7 +141,7 @@ protected function getDriver(): AbstractDriver
141141

142142
$className = __NAMESPACE__ . "\\Driver\\{$driverName}";
143143

144-
if (class_exists($className)) {
144+
if (\class_exists($className)) {
145145
/** @var AbstractDriver $driver */
146146
$driver = new $className();
147147
return $driver;
@@ -172,7 +172,7 @@ public function trigger(string $eventName, array $context = [], ?\Closure $callb
172172
return 0;
173173
}
174174

175-
array_unshift($context, $this);
175+
\array_unshift($context, $this);
176176

177177
return $this->eManager->trigger("jbzoo.http.{$eventName}", $context, $callback);
178178
}

src/Options.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class Options
4747
*/
4848
public function __construct(array $options = [])
4949
{
50-
$this->options = new Data(array_merge([
50+
$this->options = new Data(\array_merge([
5151
'auth' => [],
5252
'headers' => [],
5353
'driver' => self::DEFAULT_DRIVER,

src/Request.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function __construct(
8181
$this->setHeaders($headers);
8282

8383
$this->options = new Options();
84-
if (is_array($options)) {
84+
if (\is_array($options)) {
8585
$this->setOptions($options);
8686
} else {
8787
$this->setOptions($options->toArray());
@@ -94,7 +94,7 @@ public function __construct(
9494
*/
9595
public function setUrl(string $url): self
9696
{
97-
$this->url = trim($url);
97+
$this->url = \trim($url);
9898
return $this;
9999
}
100100

@@ -124,7 +124,7 @@ public function setHeaders(array $headers): self
124124
*/
125125
public function setMethod(string $method): self
126126
{
127-
$method = strtoupper(trim($method)) ?: self::DEFAULT_METHOD;
127+
$method = \strtoupper(\trim($method)) ?: self::DEFAULT_METHOD;
128128

129129
$validMethods = [
130130
self::GET,
@@ -134,7 +134,7 @@ public function setMethod(string $method): self
134134
self::PATCH,
135135
self::DELETE
136136
];
137-
if (!in_array($method, $validMethods, true)) {
137+
if (!\in_array($method, $validMethods, true)) {
138138
throw new Exception("Undefined HTTP method: {$method}");
139139
}
140140

@@ -148,7 +148,7 @@ public function setMethod(string $method): self
148148
*/
149149
public function setOptions(array $options): self
150150
{
151-
$this->options = new Options(array_merge($this->options->toArray(), $options));
151+
$this->options = new Options(\array_merge($this->options->toArray(), $options));
152152
return $this;
153153
}
154154

@@ -185,7 +185,7 @@ public function getMethod(): string
185185
*/
186186
public function getHeaders(): array
187187
{
188-
return array_merge($this->options->getHeaders(), $this->headers);
188+
return \array_merge($this->options->getHeaders(), $this->headers);
189189
}
190190

191191
/**

src/Response.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public function setHeaders(array $headers): self
8888
$result = [];
8989

9090
foreach ($headers as $key => $value) {
91-
if (is_array($value)) {
92-
$value = implode(';', $value);
91+
if (\is_array($value)) {
92+
$value = \implode(';', $value);
9393
}
9494

9595
$result[$key] = $value;
@@ -189,9 +189,9 @@ public function getHeader(string $headerKey, bool $ignoreCase = true): ?string
189189
{
190190
if ($ignoreCase) {
191191
$headers = [];
192-
$headerKey = strtolower($headerKey);
192+
$headerKey = \strtolower($headerKey);
193193
foreach ($this->getHeaders() as $key => $value) {
194-
$key = strtolower($key);
194+
$key = \strtolower((string)$key);
195195
$headers[$key] = $value;
196196
}
197197
} else {

0 commit comments

Comments
 (0)