LinkORB\Component\Etcd\Client::listDir PHP Method

listDir() public method

Retrieve a directory
public listDir ( string $key = '/', boolean $recursive = false ) : mixed
$key string
$recursive boolean
return mixed
    public function listDir($key = '/', $recursive = false)
    {
        $query = array();
        if ($recursive === true) {
            $query['recursive'] = 'true';
        }
        $request = $this->guzzleclient->get($this->buildKeyUri($key), null, array('query' => $query));
        $response = $request->send();
        $body = $response->json();
        if (isset($body['errorCode'])) {
            throw new KeyNotFoundException($body['message'], $body['errorCode']);
        }
        return $body;
    }

Usage Example

Example #1
0
 /**
  * @covers LinkORB\Component\Etcd\Client::listDir
  */
 public function testListDir()
 {
     $data = $this->client->listDir();
     $this->assertEquals($this->dirname, $data['node']['key']);
     $this->assertTrue($data['node']['dir'] == 1);
 }
All Usage Examples Of LinkORB\Component\Etcd\Client::listDir