1<?php 2 3declare(strict_types = 1); 4 5namespace Elasticsearch\Endpoints\Indices\Settings; 6 7use Elasticsearch\Endpoints\AbstractEndpoint; 8 9/** 10 * Class Get 11 * 12 * @category Elasticsearch 13 * @package Elasticsearch\Endpoints\Indices\Settings 14 * @author Zachary Tong <zach@elastic.co> 15 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 16 * @link http://elastic.co 17 */ 18class Get extends AbstractEndpoint 19{ 20 /** 21 * The name of the settings that should be included 22 * 23 * @var string 24 */ 25 private $name; 26 27 public function setName(?string $name): Get 28 { 29 if (isset($name) !== true) { 30 return $this; 31 } 32 33 $this->name = $name; 34 35 return $this; 36 } 37 38 public function getURI(): string 39 { 40 $index = $this->index ?? null; 41 $name = $this->name ?? null; 42 43 if (isset($index) && isset($name)) { 44 return "/$index/_settings/$name"; 45 } 46 if (isset($index)) { 47 return "/$index/_settings"; 48 } 49 if (isset($name)) { 50 return "/_settings/$name"; 51 } 52 return "/_settings"; 53 } 54 55 public function getParamWhitelist(): array 56 { 57 return [ 58 'master_timeout', 59 'ignore_unavailable', 60 'allow_no_indices', 61 'expand_wildcards', 62 'flat_settings', 63 'local', 64 'include_defaults' 65 ]; 66 } 67 68 public function getMethod(): string 69 { 70 return 'GET'; 71 } 72} 73