diff --git a/Http/Http.php b/Http/Http.php index 22febc4..a24ba17 100644 --- a/Http/Http.php +++ b/Http/Http.php @@ -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[] diff --git a/Query/Query.php b/Query/Query.php index 8567d32..c827d33 100644 --- a/Query/Query.php +++ b/Query/Query.php @@ -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 @@ -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 @@ -307,7 +307,7 @@ public static function createMatchAll(): self */ public static function createByUUID(ItemUUID $uuid): self { - return self::createByUUIDs([$uuid]); + return static::createByUUIDs([$uuid]); } /** @@ -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(); @@ -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) { @@ -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'])) { diff --git a/composer.json b/composer.json index 51aec9a..d381fc1 100644 --- a/composer.json +++ b/composer.json @@ -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",