Get.php 1.6 KB

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