diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /vendor/ruflin/elastica/lib/Elastica/Index/Status.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Index/Status.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Index/Status.php | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Index/Status.php b/vendor/ruflin/elastica/lib/Elastica/Index/Status.php index 6a343025..0b9dff48 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Index/Status.php +++ b/vendor/ruflin/elastica/lib/Elastica/Index/Status.php @@ -1,43 +1,41 @@ <?php - namespace Elastica\Index; -use Elastica\Cluster; + use Elastica\Index as BaseIndex; use Elastica\Request; /** - * Elastica index status object + * Elastica index status object. * - * @category Xodoa - * @package Elastica * @author Nicolas Ruflin <spam@ruflin.com> - * @link http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html + * + * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-status.html */ class Status { /** - * Response + * Response. * * @var \Elastica\Response Response object */ protected $_response = null; /** - * Stats info + * Stats info. * * @var array Stats info */ protected $_data = array(); /** - * Index + * Index. * * @var \Elastica\Index Index object */ protected $_index = null; /** - * Construct + * Construct. * * @param \Elastica\Index $index Index object */ @@ -48,7 +46,7 @@ class Status } /** - * Returns all status info + * Returns all status info. * * @return array Status info */ @@ -72,7 +70,7 @@ class Status if (isset($data[$arg])) { $data = $data[$arg]; } else { - return null; + return; } } @@ -80,31 +78,39 @@ class Status } /** - * Returns all index aliases + * Returns all index aliases. * * @return array Aliases */ public function getAliases() { $responseData = $this->getIndex()->request('_aliases', \Elastica\Request::GET)->getData(); - return array_keys($responseData[$this->getIndex()->getName()]['aliases']); + + $data = $responseData[$this->getIndex()->getName()]; + if (!empty($data['aliases'])) { + return array_keys($data['aliases']); + } + + return array(); } /** - * Returns all index settings + * Returns all index settings. * * @return array Index settings */ public function getSettings() { $responseData = $this->getIndex()->request('_settings', \Elastica\Request::GET)->getData(); + return $responseData[$this->getIndex()->getName()]['settings']; } /** - * Checks if the index has the given alias + * Checks if the index has the given alias. + * + * @param string $name Alias name * - * @param string $name Alias name * @return bool */ public function hasAlias($name) @@ -113,7 +119,7 @@ class Status } /** - * Returns the index object + * Returns the index object. * * @return \Elastica\Index Index object */ @@ -123,7 +129,7 @@ class Status } /** - * Returns response object + * Returns response object. * * @return \Elastica\Response Response object */ @@ -133,7 +139,7 @@ class Status } /** - * Reloads all status data of this object + * Reloads all status data of this object. */ public function refresh() { |