| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace OpenSearch; |
| 6: | |
| 7: | use OpenSearch\Endpoints\AbstractEndpoint; |
| 8: | |
| 9: | |
| 10: | @trigger_error(LegacyEndpointFactory::class . ' is deprecated in 2.4.0 and will be removed in 3.0.0.', E_USER_DEPRECATED); |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | class LegacyEndpointFactory implements EndpointFactoryInterface |
| 18: | { |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | protected $endpoints; |
| 25: | |
| 26: | public function __construct(callable $endpoints) |
| 27: | { |
| 28: | $this->endpoints = $endpoints; |
| 29: | } |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function getEndpoint(string $class): AbstractEndpoint |
| 35: | { |
| 36: | |
| 37: | $class = str_replace('OpenSearch\\Endpoints\\', '', $class); |
| 38: | $endpointBuilder = $this->endpoints; |
| 39: | return $endpointBuilder($class); |
| 40: | } |
| 41: | |
| 42: | } |
| 43: | |