Skip to content

Commit

Permalink
Addressed feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Pepper <kim@pepper.id.au>
  • Loading branch information
kimpepper committed Nov 12, 2024
1 parent 12209dd commit a0bdb57
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions util/template/client-class
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ use OpenSearch\Traits\DeprecatedPropertyTrait;
class Client
{

use DeprecatedPropertyTrait;

const VERSION = '2.3.1';

/**
Expand All @@ -51,10 +49,12 @@ class Client
*/
protected $params;

protected EndpointFactoryInterface $endpointFactory;
private EndpointFactoryInterface $endpointFactory;

/**
* @var callable
*
* @deprecated in 2.3.2 and will be removed in 3.0.0.
*/
protected $endpoints;

Expand All @@ -79,7 +79,10 @@ class Client
$endpoints = $endpointFactory;
$endpointFactory = new LegacyEndpointFactory($endpointFactory);
} else {
$endpoints = fn ($c) => $endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c);
$endpoints = function ($c) {
@trigger_error('The $endpoints property is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED);
$endpointFactory->getEndpoint('OpenSearch\\Endpoints\\' . $c);
};
}
$this->endpoints = $endpoints;
$this->endpointFactory = $endpointFactory;
Expand All @@ -90,15 +93,10 @@ class Client
:functions

/**
* Checks for access to deprecated properties.
* Gets the endpoint factory.
*/
public function __get(string $name): mixed
{
if ($name === 'endpoints') {
@trigger_error('The $endpoints property is deprecated in 2.3.2 and will be removed in 3.0.0. Use $endpointFactory instead.', E_USER_DEPRECATED);
return $this->endpoints;
}
return null;
protected function getEndpointFactory(): EndpointFactoryInterface {
return $this->endpointFactory;
}

/**
Expand Down

0 comments on commit a0bdb57

Please sign in to comment.