diff --git a/util/EndpointProxies/indices/getAliasesProxy.php b/util/EndpointProxies/indices/getAliasesProxy.php new file mode 100644 index 00000000..3969b8d1 --- /dev/null +++ b/util/EndpointProxies/indices/getAliasesProxy.php @@ -0,0 +1,15 @@ +getAlias($params); +} +EOD; diff --git a/util/EndpointProxies/tasks/tasksListProxy.php b/util/EndpointProxies/tasks/tasksListProxy.php new file mode 100644 index 00000000..46067693 --- /dev/null +++ b/util/EndpointProxies/tasks/tasksListProxy.php @@ -0,0 +1,12 @@ +list($params); +} +EOD; diff --git a/util/NamespaceEndpoint.php b/util/NamespaceEndpoint.php index c87d3695..dab73515 100644 --- a/util/NamespaceEndpoint.php +++ b/util/NamespaceEndpoint.php @@ -70,14 +70,13 @@ public function renderClass(): string foreach ($this->endpoints as $endpoint) { $endpoints .= $this->renderEndpoint($endpoint); } - // Fix for BC in 7.2.0 - switch ($this->name) { - case 'indices': - $endpoints .= $this->getAliasesProxy(); - break; - case 'tasks': - $endpoints .= $this->tasksListProxy(); - break; + + $proxyFolder = 'util/endpointproxies/' . $this->name; + if (is_dir($proxyFolder)) { + $proxyFiles = glob($proxyFolder . '/*.php'); + foreach ($proxyFiles as $file) { + $endpoints .= require $file; + } } $class = str_replace(':endpoints', $endpoints, $class); @@ -159,35 +158,4 @@ function ($matches) { $name ); } - - protected function getAliasesProxy(): string - { - return <<<'EOD' - - /** - * Alias function to getAlias() - * - * @deprecated added to prevent BC break introduced in 7.2.0 - * @see https://github.com/elastic/elasticsearch-php/issues/940 - */ - public function getAliases(array $params = []) - { - return $this->getAlias($params); - } -EOD; - } - - protected function tasksListProxy(): string - { - return <<<'EOD' - - /** - * Proxy function to list() to prevent BC break since 7.4.0 - */ - public function tasksList(array $params = []) - { - return $this->list($params); - } -EOD; - } }