diff options
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Status.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Status.php | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Status.php b/vendor/ruflin/elastica/lib/Elastica/Status.php index a747b9a5..c22a5f61 100644 --- a/vendor/ruflin/elastica/lib/Elastica/Status.php +++ b/vendor/ruflin/elastica/lib/Elastica/Status.php @@ -1,42 +1,41 @@ <?php - namespace Elastica; + use Elastica\Exception\ResponseException; use Elastica\Index\Status as IndexStatus; /** - * Elastica general status + * Elastica general status. * - * @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 { /** - * Contains all status infos + * Contains all status infos. * * @var \Elastica\Response Response object */ protected $_response = null; /** - * Data + * Data. * * @var array Data */ protected $_data = array(); /** - * Client object + * Client object. * * @var \Elastica\Client Client object */ protected $_client = null; /** - * Constructs Status object + * Constructs Status object. * * @param \Elastica\Client $client Client object */ @@ -47,7 +46,7 @@ class Status } /** - * Returns status data + * Returns status data. * * @return array Status data */ @@ -57,7 +56,7 @@ class Status } /** - * Returns status objects of all indices + * Returns status objects of all indices. * * @return array|\Elastica\Index\Status[] List of Elastica\Client\Index objects */ @@ -73,25 +72,21 @@ class Status } /** - * Returns a list of the existing index names + * Returns a list of the existing index names. * * @return array Index names list */ public function getIndexNames() { - $names = array(); - foreach ($this->_data['indices'] as $name => $data) { - $names[] = $name; - } - - return $names; + return array_keys($this->_data['indices']); } /** - * Checks if the given index exists + * Checks if the given index exists. * - * @param string $name Index name to check - * @return bool True if index exists + * @param string $name Index name to check + * + * @return bool True if index exists */ public function indexExists($name) { @@ -99,10 +94,11 @@ class Status } /** - * Checks if the given alias exists + * Checks if the given alias exists. + * + * @param string $name Alias name * - * @param string $name Alias name - * @return bool True if alias exists + * @return bool True if alias exists */ public function aliasExists($name) { @@ -110,16 +106,17 @@ class Status } /** - * Returns an array with all indices that the given alias name points to + * Returns an array with all indices that the given alias name points to. + * + * @param string $alias Alias name * - * @param string $alias Alias name * @return array|\Elastica\Index[] List of Elastica\Index */ public function getIndicesWithAlias($alias) { $response = null; try { - $response = $this->_client->request('/_alias/' . $alias); + $response = $this->_client->request('/_alias/'.$alias); } catch (ResponseException $e) { $transferInfo = $e->getResponse()->getTransferInfo(); // 404 means the index alias doesn't exist which means no indexes have it. @@ -133,11 +130,12 @@ class Status foreach ($response->getData() as $name => $unused) { $indices[] = new Index($this->_client, $name); } + return $indices; } /** - * Returns response object + * Returns response object. * * @return \Elastica\Response Response object */ @@ -147,7 +145,7 @@ class Status } /** - * Return shards info + * Return shards info. * * @return array Shards info */ @@ -157,7 +155,7 @@ class Status } /** - * Refresh status object + * Refresh status object. */ public function refresh() { @@ -167,7 +165,7 @@ class Status } /** - * Refresh serverStatus object + * Refresh serverStatus object. */ public function getServerStatus() { |