@@ -86,18 +86,22 @@ public function get($key, QueryOptions $queryOptions = null)
86
86
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
87
87
* )
88
88
*/
89
- public function valueList ($ prefix , QueryOptions $ queryOptions = null )
89
+ public function valueList ($ prefix = '' , QueryOptions $ queryOptions = null )
90
90
{
91
- if (!is_string ($ prefix ) || '' === $ prefix )
91
+ if (!is_string ($ prefix ))
92
92
{
93
93
return [null , null , new Error (sprintf (
94
- '%s::valueList - Prefix expected to be non-empty string, "%s" seen. ' ,
94
+ '%s::valueList - Prefix expected to be string, "%s" seen. ' ,
95
95
get_class ($ this ),
96
- is_string ( $ prefix ) ? $ prefix : gettype ($ prefix )
96
+ gettype ($ prefix )
97
97
))];
98
98
}
99
99
100
- $ r = new HttpRequest ('get ' , sprintf ('v1/kv/%s ' , $ prefix ), $ this ->_Config );
100
+ if ('' === $ prefix )
101
+ $ r = new HttpRequest ('get ' , 'v1/kv ' , $ this ->_Config );
102
+ else
103
+ $ r = new HttpRequest ('get ' , sprintf ('v1/kv/%s ' , $ prefix ), $ this ->_Config );
104
+
101
105
$ r ->setQueryOptions ($ queryOptions );
102
106
$ r ->params ->set ('recurse ' , '' );
103
107
@@ -276,7 +280,7 @@ public function release(KVPair $p, WriteOptions $writeOptions = null)
276
280
* @type \DCarbone\PHPConsulAPI\Error|null error, if any
277
281
* )
278
282
*/
279
- public function tree ($ prefix , QueryOptions $ queryOptions = null )
283
+ public function tree ($ prefix = '' , QueryOptions $ queryOptions = null )
280
284
{
281
285
list ($ valueList , $ _ , $ err ) = $ this ->valueList ($ prefix , $ queryOptions );
282
286
0 commit comments