Skip to content

Commit

Permalink
okay ?
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed Oct 14, 2024
1 parent adb632f commit 95aa4eb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
22 changes: 13 additions & 9 deletions clients/algoliasearch-client-php/lib/Algolia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
namespace Algolia\AlgoliaSearch;

use Algolia\AlgoliaSearch\Cache\NullCacheDriver;
use Algolia\AlgoliaSearch\Http\CurlHttpClient;
use Algolia\AlgoliaSearch\Http\GuzzleHttpClient;
use Algolia\AlgoliaSearch\Http\HttpClientInterface;
use Algolia\AlgoliaSearch\Log\DebugLogger;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use Psr\Log\LoggerInterface;
use Psr\SimpleCache\CacheInterface;

Expand All @@ -15,19 +19,19 @@ final class Algolia
/**
* Holds an instance of the simple cache repository (PSR-16).
*
* @var null|\Psr\SimpleCache\CacheInterface
* @var null|CacheInterface
*/
private static $cache;

/**
* Holds an instance of the logger (PSR-3).
*
* @var null|\Psr\Log\LoggerInterface
* @var null|LoggerInterface
*/
private static $logger;

/**
* @var \Algolia\AlgoliaSearch\Http\HttpClientInterface
* @var HttpClientInterface
*/
private static $httpClient;

Expand All @@ -43,7 +47,7 @@ public static function isCacheEnabled()
/**
* Gets the cache instance.
*
* @return \Psr\SimpleCache\CacheInterface
* @return CacheInterface
*/
public static function getCache()
{
Expand All @@ -65,7 +69,7 @@ public static function setCache(CacheInterface $cache)
/**
* Gets the logger instance.
*
* @return \Psr\Log\LoggerInterface
* @return LoggerInterface
*/
public static function getLogger()
{
Expand All @@ -90,23 +94,23 @@ public static function getHttpClient()
if (interface_exists('\GuzzleHttp\ClientInterface')) {
if (defined('\GuzzleHttp\ClientInterface::VERSION')) {
$guzzleVersion = (int) mb_substr(
\GuzzleHttp\Client::VERSION,
Client::VERSION,
0,
1
);
} else {
$guzzleVersion = \GuzzleHttp\ClientInterface::MAJOR_VERSION;
$guzzleVersion = ClientInterface::MAJOR_VERSION;
}
}

if (null === self::$httpClient) {
if (class_exists('\GuzzleHttp\Client') && 6 <= $guzzleVersion) {
self::setHttpClient(
new \Algolia\AlgoliaSearch\Http\GuzzleHttpClient()
new GuzzleHttpClient()
);
} else {
self::setHttpClient(
new \Algolia\AlgoliaSearch\Http\CurlHttpClient()
new CurlHttpClient()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ private void exploreGraph(OperationsMap operations) {
}
}
for (CodegenParameter param : ope.allParams) {
CodegenModel paramType = getModel(param.baseType != null ? param.baseType : param.getSchema().getOpenApiType());
String paramName = param.baseType != null ? param.baseType : param.dataType;
// php has a fully qualified name for the parameter type
if (paramName.contains("\\")) {
paramName = paramName.substring(paramName.lastIndexOf("\\") + 1);
}
CodegenModel paramType = getModel(paramName);
if (paramType != null) {
visitedModels.add(paramType.name);
}
Expand Down
1 change: 0 additions & 1 deletion specs/common/schemas/IndexSettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ widgets:
banners:
description: banners defined in the merchandising studio for the given search.
type: array
additionalProperties: false
items:
$ref: '#/banner'

Expand Down

0 comments on commit 95aa4eb

Please sign in to comment.