Elastica\Cluster\Health\Index::getShards PHP Method

getShards() public method

Gets the health of the shards in this index.
public getShards ( ) : Elastica\Cluster\Health\Shard[]
return Elastica\Cluster\Health\Shard[]
    public function getShards()
    {
        $shards = [];
        foreach ($this->_data['shards'] as $shardNumber => $shard) {
            $shards[] = new Shard($shardNumber, $shard);
        }
        return $shards;
    }

Usage Example

 public function testGetShards()
 {
     $shards = $this->_index->getShards();
     $this->assertInternalType('array', $shards);
     $this->assertEquals(3, count($shards));
     foreach ($shards as $shard) {
         $this->assertInstanceOf('Elastica\\Cluster\\Health\\Shard', $shard);
     }
 }