Skip to content

Commit fbb82dd

Browse files
committed
chore:format PHP
1 parent 3444af0 commit fbb82dd

28 files changed

+550
-237
lines changed

.github/.cache_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9.2.2
1+
9.2.3

clients/algoliasearch-client-php/.php-cs-fixer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
return $config
66
->setUsingCache(true)
77
->setRules([
8-
'array_syntax' => [ 'syntax' => 'short' ],
8+
'array_syntax' => ['syntax' => 'short'],
99
'blank_line_after_namespace' => false,
1010
'blank_line_after_opening_tag' => true,
1111
'blank_line_before_statement' => true,
@@ -43,7 +43,7 @@
4343
'phpdoc_tag_type' => true,
4444
'protected_to_private' => true,
4545
'@PSR2' => true,
46-
'short_scalar_cast' => true,
46+
'short_scalar_cast' => true,
4747
'single_blank_line_at_eof' => false,
4848
'single_blank_line_before_namespace' => true,
4949
'single_quote' => true,
@@ -57,7 +57,7 @@
5757
])
5858
->setFinder(
5959
PhpCsFixer\Finder::create()
60-
->exclude('test')
61-
->exclude('tests')
62-
->in(__DIR__)
60+
->exclude('test')
61+
->exclude('tests')
62+
->in(__DIR__)
6363
);
Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
{
2-
"name": "algolia/algoliasearch-client-php",
3-
"description": "API powering the features of Algolia.",
4-
"keywords": [
5-
"openapitools",
6-
"openapi-generator",
7-
"openapi",
8-
"php",
9-
"sdk",
10-
"rest",
11-
"api"
12-
],
13-
"homepage": "https://openapi-generator.tech",
14-
"license": "unlicense",
15-
"authors": [
16-
{
17-
"name": "OpenAPI-Generator contributors",
18-
"homepage": "https://openapi-generator.tech"
19-
}
20-
],
21-
"require": {
22-
"php": "^7.3 || ^8.0",
23-
"ext-curl": "*",
24-
"ext-json": "*",
25-
"ext-mbstring": "*",
26-
"guzzlehttp/guzzle": "^7.3",
27-
"guzzlehttp/psr7": "^2.0",
28-
"psr/http-message": "^1.0",
29-
"psr/log": "^1.0 || ^2.0 || ^3.0",
30-
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
31-
},
32-
"require-dev": {
33-
"friendsofphp/php-cs-fixer": "^3.5.0",
34-
"phpunit/phpunit": "^9.3"
35-
},
36-
"autoload": {
37-
"psr-4": { "Algolia\\AlgoliaSearch\\" : "lib/" },
38-
"files": [
39-
"lib/Http/Psr7/functions.php"
40-
]
2+
"name": "algolia/algoliasearch-client-php",
3+
"description": "API powering the features of Algolia.",
4+
"keywords": [
5+
"openapitools",
6+
"openapi-generator",
7+
"openapi",
8+
"php",
9+
"sdk",
10+
"rest",
11+
"api"
12+
],
13+
"homepage": "https://openapi-generator.tech",
14+
"license": "unlicense",
15+
"authors": [
16+
{
17+
"name": "OpenAPI-Generator contributors",
18+
"homepage": "https://openapi-generator.tech"
19+
}
20+
],
21+
"require": {
22+
"php": "^7.3 || ^8.0",
23+
"ext-curl": "*",
24+
"ext-json": "*",
25+
"ext-mbstring": "*",
26+
"guzzlehttp/guzzle": "^7.3",
27+
"guzzlehttp/psr7": "^2.0",
28+
"psr/http-message": "^1.0",
29+
"psr/log": "^1.0 || ^2.0 || ^3.0",
30+
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
31+
},
32+
"require-dev": {
33+
"friendsofphp/php-cs-fixer": "^3.5.0",
34+
"phpunit/phpunit": "^9.3"
35+
},
36+
"autoload": {
37+
"psr-4": {
38+
"Algolia\\AlgoliaSearch\\": "lib/"
4139
},
42-
"autoload-dev": {
43-
"psr-4": { "Algolia\\AlgoliaSearch\\Test\\" : "test/" }
40+
"files": [
41+
"lib/Http/Psr7/functions.php"
42+
]
43+
},
44+
"autoload-dev": {
45+
"psr-4": {
46+
"Algolia\\AlgoliaSearch\\Test\\": "test/"
4447
}
48+
}
4549
}

clients/algoliasearch-client-php/lib/Algolia.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ public static function setLogger(LoggerInterface $logger)
8787
public static function getHttpClient()
8888
{
8989
if (null === self::$httpClient) {
90-
self::setHttpClient(new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient());
90+
self::setHttpClient(
91+
new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient()
92+
);
9193
}
9294

9395
return self::$httpClient;

clients/algoliasearch-client-php/lib/ApiException.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ class ApiException extends Exception
4141
* @param string[]|null $responseHeaders HTTP response header
4242
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
4343
*/
44-
public function __construct($message = '', $code = 0, $responseHeaders = [], $responseBody = null)
45-
{
44+
public function __construct(
45+
$message = '',
46+
$code = 0,
47+
$responseHeaders = [],
48+
$responseBody = null
49+
) {
4650
parent::__construct($message, $code);
4751
$this->responseHeaders = $responseHeaders;
4852
$this->responseBody = $responseBody;

clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ final class FileCacheDriver implements CacheInterface
1212

1313
public function __construct($directory)
1414
{
15-
$this->directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
15+
$this->directory =
16+
rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
1617
}
1718

1819
/**
@@ -49,7 +50,7 @@ public function delete($key)
4950
public function clear()
5051
{
5152
$result = true;
52-
foreach (glob($this->directory.self::PREFIX.'*') as $file) {
53+
foreach (glob($this->directory . self::PREFIX . '*') as $file) {
5354
$result &= @unlink($file);
5455
}
5556

@@ -110,7 +111,7 @@ public function has($key)
110111
*/
111112
private function getFilenameFromKey($key)
112113
{
113-
$name = $this->directory.self::PREFIX.$key;
114+
$name = $this->directory . self::PREFIX . $key;
114115

115116
return str_replace('\\', '-', $name);
116117
}

clients/algoliasearch-client-php/lib/Configuration/ConfigWithRegion.php

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

77
abstract class ConfigWithRegion extends Configuration
88
{
9-
public static function create($appId, $apiKey, $region = null, $allowedRegions = null)
10-
{
9+
public static function create(
10+
$appId,
11+
$apiKey,
12+
$region = null,
13+
$allowedRegions = null
14+
) {
1115
if ($region !== null && !in_array($region, $allowedRegions, true)) {
1216
throw new AlgoliaException('Specified region is not allowed.');
1317
}

clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ final class UnreachableException extends AlgoliaException
77
public function __construct($message = '', $code = 0, $previous = null)
88
{
99
if (!$message) {
10-
$message = 'Impossible to connect, please check your Algolia Application Id.';
10+
$message =
11+
'Impossible to connect, please check your Algolia Application Id.';
1112
}
1213

1314
parent::__construct($message, $code, $previous);

clients/algoliasearch-client-php/lib/Http/GuzzleHttpClient.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ public function __construct(GuzzleClient $client = null)
1919
$this->client = $client ?: static::buildClient();
2020
}
2121

22-
public function sendRequest(RequestInterface $request, $timeout, $connectTimeout)
23-
{
22+
public function sendRequest(
23+
RequestInterface $request,
24+
$timeout,
25+
$connectTimeout
26+
) {
2427
try {
2528
$response = $this->client->send($request, [
2629
'timeout' => $timeout,
@@ -31,21 +34,9 @@ public function sendRequest(RequestInterface $request, $timeout, $connectTimeout
3134
return $e->getResponse();
3235
}
3336

34-
return new Response(
35-
0,
36-
[],
37-
null,
38-
'1.1',
39-
$e->getMessage()
40-
);
37+
return new Response(0, [], null, '1.1', $e->getMessage());
4138
} catch (ConnectException $e) {
42-
return new Response(
43-
0,
44-
[],
45-
null,
46-
'1.1',
47-
$e->getMessage()
48-
);
39+
return new Response(0, [], null, '1.1', $e->getMessage());
4940
}
5041

5142
return $response;

clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@ interface HttpClientInterface
2020
*
2121
* @return ResponseInterface
2222
*/
23-
public function sendRequest(RequestInterface $request, $timeout, $connectTimeout);
23+
public function sendRequest(
24+
RequestInterface $request,
25+
$timeout,
26+
$connectTimeout
27+
);
2428
}

clients/algoliasearch-client-php/lib/Http/Psr7/BufferStream.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ public function eof()
9292

9393
public function tell()
9494
{
95-
throw new \RuntimeException('Cannot determine the position of a BufferStream');
95+
throw new \RuntimeException(
96+
'Cannot determine the position of a BufferStream'
97+
);
9698
}
9799

98100
/**

clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public function __construct(callable $source, array $options = [])
4747
{
4848
$this->source = $source;
4949
$this->size = isset($options['size']) ? $options['size'] : null;
50-
$this->metadata = isset($options['metadata']) ? $options['metadata'] : [];
50+
$this->metadata = isset($options['metadata'])
51+
? $options['metadata']
52+
: [];
5153
$this->buffer = new BufferStream();
5254
}
5355

clients/algoliasearch-client-php/lib/Http/Psr7/Request.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function getRequestTarget()
8080
$target = '/';
8181
}
8282
if ('' !== $this->uri->getQuery()) {
83-
$target .= '?'.$this->uri->getQuery();
83+
$target .= '?' . $this->uri->getQuery();
8484
}
8585

8686
return $target;
@@ -89,7 +89,9 @@ public function getRequestTarget()
8989
public function withRequestTarget($requestTarget)
9090
{
9191
if (preg_match('#\s#', $requestTarget)) {
92-
throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace');
92+
throw new InvalidArgumentException(
93+
'Invalid request target provided; cannot contain whitespace'
94+
);
9395
}
9496

9597
$new = clone $this;
@@ -141,7 +143,7 @@ private function updateHostFromUri()
141143
}
142144

143145
if (null !== ($port = $this->uri->getPort())) {
144-
$host .= ':'.$port;
146+
$host .= ':' . $port;
145147
}
146148

147149
if (isset($this->headerNames['host'])) {
@@ -224,7 +226,10 @@ public function withAddedHeader($header, $value)
224226
$new = clone $this;
225227
if (isset($new->headerNames[$normalized])) {
226228
$header = $this->headerNames[$normalized];
227-
$new->headers[$header] = array_merge($this->headers[$header], $value);
229+
$new->headers[$header] = array_merge(
230+
$this->headers[$header],
231+
$value
232+
);
228233
} else {
229234
$new->headerNames[$normalized] = $header;
230235
$new->headers[$header] = $value;
@@ -277,7 +282,10 @@ private function setHeaders(array $headers)
277282
$normalized = mb_strtolower($header);
278283
if (isset($this->headerNames[$normalized])) {
279284
$header = $this->headerNames[$normalized];
280-
$this->headers[$header] = array_merge($this->headers[$header], $value);
285+
$this->headers[$header] = array_merge(
286+
$this->headers[$header],
287+
$value
288+
);
281289
} else {
282290
$this->headerNames[$normalized] = $header;
283291
$this->headers[$header] = $value;

clients/algoliasearch-client-php/lib/Http/Psr7/Response.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ public function withAddedHeader($header, $value)
225225
$new = clone $this;
226226
if (isset($new->headerNames[$normalized])) {
227227
$header = $this->headerNames[$normalized];
228-
$new->headers[$header] = array_merge($this->headers[$header], $value);
228+
$new->headers[$header] = array_merge(
229+
$this->headers[$header],
230+
$value
231+
);
229232
} else {
230233
$new->headerNames[$normalized] = $header;
231234
$new->headers[$header] = $value;
@@ -283,7 +286,10 @@ private function setHeaders(array $headers)
283286
$normalized = mb_strtolower($header);
284287
if (isset($this->headerNames[$normalized])) {
285288
$header = $this->headerNames[$normalized];
286-
$this->headers[$header] = array_merge($this->headers[$header], $value);
289+
$this->headers[$header] = array_merge(
290+
$this->headers[$header],
291+
$value
292+
);
287293
} else {
288294
$this->headerNames[$normalized] = $header;
289295
$this->headers[$header] = $value;

0 commit comments

Comments
 (0)