Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit d95f6c2

Browse files
authored
Merge pull request #127 from apisearch-io/fix/fixed-query-static-access
Used static access in Query
2 parents d8dbbb8 + f306f67 commit d95f6c2

File tree

3 files changed

+12
-42
lines changed

3 files changed

+12
-42
lines changed

Http/Http.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,14 @@
2222
*/
2323
class Http
2424
{
25-
/**
26-
* @var string
27-
*
28-
* Token query param field
29-
*/
3025
const TOKEN_FIELD = 'token';
31-
32-
/**
33-
* @var string
34-
*
35-
* Changes query param field
36-
*/
3726
const CHANGES_FIELD = 'changes';
38-
39-
/**
40-
* @var string
41-
*
42-
* Query query param field
43-
*/
4427
const QUERY_FIELD = 'query';
4528

46-
/**
47-
* @var string
48-
*
49-
* App ID Header
50-
*/
5129
const APP_ID_HEADER = 'APISEARCH-APP-ID';
52-
53-
/**
54-
* @var string
55-
*
56-
* Token ID Header
57-
*/
5830
const TOKEN_ID_HEADER = 'APISEARCH-TOKEN-ID';
5931

6032
/**
61-
* Get common query values.
62-
*
6333
* @param RepositoryWithCredentials $repository
6434
*
6535
* @return string[]

Query/Query.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public static function createLocated(
250250
int $page = self::DEFAULT_PAGE,
251251
int $size = self::DEFAULT_SIZE
252252
) {
253-
$query = self::create(
253+
$query = static::create(
254254
$queryText,
255255
$page,
256256
$size
@@ -291,7 +291,7 @@ public static function create(
291291
*/
292292
public static function createMatchAll(): self
293293
{
294-
return self::create(
294+
return static::create(
295295
'',
296296
self::DEFAULT_PAGE,
297297
self::DEFAULT_SIZE
@@ -307,7 +307,7 @@ public static function createMatchAll(): self
307307
*/
308308
public static function createByUUID(ItemUUID $uuid): self
309309
{
310-
return self::createByUUIDs([$uuid]);
310+
return static::createByUUIDs([$uuid]);
311311
}
312312

313313
/**
@@ -323,7 +323,7 @@ public static function createByUUIDs(array $uuids): self
323323
return $uuid->composeUUID();
324324
}, $uuids);
325325

326-
$query = self::create('', self::DEFAULT_PAGE, count($uuids))
326+
$query = static::create('', self::DEFAULT_PAGE, count($uuids))
327327
->disableAggregations()
328328
->disableSuggestions();
329329

@@ -1546,16 +1546,16 @@ public function toArray(): array
15461546
public static function createFromArray(array $array): self
15471547
{
15481548
$query = isset($array['coordinate'])
1549-
? self::createLocated(
1549+
? static::createLocated(
15501550
Coordinate::createFromArray($array['coordinate']),
15511551
$array['q'] ?? '',
1552-
(int) ($array['page'] ?? self::DEFAULT_PAGE),
1553-
(int) ($array['size'] ?? self::DEFAULT_SIZE)
1552+
(int) ($array['page'] ?? static::DEFAULT_PAGE),
1553+
(int) ($array['size'] ?? static::DEFAULT_SIZE)
15541554
)
1555-
: self::create(
1555+
: static::create(
15561556
$array['q'] ?? '',
1557-
(int) ($array['page'] ?? self::DEFAULT_PAGE),
1558-
(int) ($array['size'] ?? self::DEFAULT_SIZE)
1557+
(int) ($array['page'] ?? static::DEFAULT_PAGE),
1558+
(int) ($array['size'] ?? static::DEFAULT_SIZE)
15591559
);
15601560
$query->fields = $array['fields'] ?? [];
15611561
$query->aggregations = array_map(function (array $aggregation) {
@@ -1587,7 +1587,7 @@ public static function createFromArray(array $array): self
15871587
$query->scoreStrategies = isset($array['score_strategies'])
15881588
? ScoreStrategies::createFromArray($array['score_strategies'])
15891589
: null;
1590-
$query->minScore = $array['min_score'] ?? self::NO_MIN_SCORE;
1590+
$query->minScore = $array['min_score'] ?? static::NO_MIN_SCORE;
15911591
$query->metadata = $array['metadata'] ?? [];
15921592

15931593
if (isset($array['user'])) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.1",
13+
"php": ">=7.2",
1414
"ext-curl": "*",
1515
"symfony/event-dispatcher": "^3.4 || ^4.0 || ^5.0",
1616
"symfony/yaml": "^3.4 || ^4.0 || ^5.0",

0 commit comments

Comments
 (0)