AbstractAliasEndpoint.php 925 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Elasticsearch\Endpoints\Indices\Alias;
  3. use Elasticsearch\Common\Exceptions\InvalidArgumentException;
  4. use Elasticsearch\Endpoints\AbstractEndpoint;
  5. /**
  6. * Class AbstractAliasEndpoint
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Indices\Alias
  10. * @author Zachary Tong <zach@elastic.co>
  11. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  12. * @link http://elastic.co
  13. */
  14. abstract class AbstractAliasEndpoint extends AbstractEndpoint
  15. {
  16. /** @var null|string */
  17. protected $name = null;
  18. /**
  19. * @param $name
  20. *
  21. * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException
  22. *
  23. * @return $this
  24. */
  25. public function setName($name)
  26. {
  27. if (is_string($name) !== true) {
  28. throw new InvalidArgumentException('Name must be a string');
  29. }
  30. $this->name = urlencode($name);
  31. return $this;
  32. }
  33. }