Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions Http/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,14 @@
*/
class Http
{
/**
* @var string
*
* Token query param field
*/
const TOKEN_FIELD = 'token';

/**
* @var string
*
* Changes query param field
*/
const CHANGES_FIELD = 'changes';

/**
* @var string
*
* Query query param field
*/
const QUERY_FIELD = 'query';

/**
* @var string
*
* App ID Header
*/
const APP_ID_HEADER = 'APISEARCH-APP-ID';

/**
* @var string
*
* Token ID Header
*/
const TOKEN_ID_HEADER = 'APISEARCH-TOKEN-ID';

/**
* Get common query values.
*
* @param RepositoryWithCredentials $repository
*
* @return string[]
Expand Down
22 changes: 11 additions & 11 deletions Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static function createLocated(
int $page = self::DEFAULT_PAGE,
int $size = self::DEFAULT_SIZE
) {
$query = self::create(
$query = static::create(
$queryText,
$page,
$size
Expand Down Expand Up @@ -291,7 +291,7 @@ public static function create(
*/
public static function createMatchAll(): self
{
return self::create(
return static::create(
'',
self::DEFAULT_PAGE,
self::DEFAULT_SIZE
Expand All @@ -307,7 +307,7 @@ public static function createMatchAll(): self
*/
public static function createByUUID(ItemUUID $uuid): self
{
return self::createByUUIDs([$uuid]);
return static::createByUUIDs([$uuid]);
}

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

$query = self::create('', self::DEFAULT_PAGE, count($uuids))
$query = static::create('', self::DEFAULT_PAGE, count($uuids))
->disableAggregations()
->disableSuggestions();

Expand Down Expand Up @@ -1546,16 +1546,16 @@ public function toArray(): array
public static function createFromArray(array $array): self
{
$query = isset($array['coordinate'])
? self::createLocated(
? static::createLocated(
Coordinate::createFromArray($array['coordinate']),
$array['q'] ?? '',
(int) ($array['page'] ?? self::DEFAULT_PAGE),
(int) ($array['size'] ?? self::DEFAULT_SIZE)
(int) ($array['page'] ?? static::DEFAULT_PAGE),
(int) ($array['size'] ?? static::DEFAULT_SIZE)
)
: self::create(
: static::create(
$array['q'] ?? '',
(int) ($array['page'] ?? self::DEFAULT_PAGE),
(int) ($array['size'] ?? self::DEFAULT_SIZE)
(int) ($array['page'] ?? static::DEFAULT_PAGE),
(int) ($array['size'] ?? static::DEFAULT_SIZE)
);
$query->fields = $array['fields'] ?? [];
$query->aggregations = array_map(function (array $aggregation) {
Expand Down Expand Up @@ -1587,7 +1587,7 @@ public static function createFromArray(array $array): self
$query->scoreStrategies = isset($array['score_strategies'])
? ScoreStrategies::createFromArray($array['score_strategies'])
: null;
$query->minScore = $array['min_score'] ?? self::NO_MIN_SCORE;
$query->minScore = $array['min_score'] ?? static::NO_MIN_SCORE;
$query->metadata = $array['metadata'] ?? [];

if (isset($array['user'])) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=7.1",
"php": ">=7.2",
"ext-curl": "*",
"symfony/event-dispatcher": "^3.4 || ^4.0 || ^5.0",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0",
Expand Down