1717*/
1818
1919use DCarbone \PHPConsulAPI \AbstractConsulClient ;
20+ use DCarbone \PHPConsulAPI \Hydrator ;
2021use DCarbone \PHPConsulAPI \Request ;
2122
2223/**
@@ -50,9 +51,9 @@ public function self()
5051 if (null !== $ err )
5152 return [null , $ qm , $ err ];
5253
53- $ this ->_self = new AgentSelf ($ data );
54+ $ this ->_self = Hydrator:: AgentSelf ($ data );
5455
55- return [new AgentSelf ( $ data ) , $ qm , null ];
56+ return [$ this -> _self , $ qm , null ];
5657 }
5758
5859 /**
@@ -70,7 +71,7 @@ public function nodeName()
7071 return ['' , $ err ];
7172 }
7273
73- return [$ this ->_self ->getConfig ()-> getNodeName () , null ];
74+ return [$ this ->_self ->Config -> NodeName , null ];
7475 }
7576
7677 /**
@@ -96,7 +97,7 @@ public function checks()
9697 $ checks = array ();
9798 foreach ($ data as $ k => $ v )
9899 {
99- $ checks [$ k ] = new AgentCheck ($ v );
100+ $ checks [$ k ] = Hydrator:: AgentCheck ($ v );
100101 }
101102
102103 return [$ checks , null ];
@@ -125,7 +126,7 @@ public function services()
125126 $ services = array ();
126127 foreach ($ data as $ k => $ v )
127128 {
128- $ services [$ k ] = new AgentService ($ v );
129+ $ services [$ k ] = Hydrator:: AgentService ($ v );
129130 }
130131
131132 return [$ services , null ];
@@ -154,7 +155,7 @@ public function members()
154155 $ members = array ();
155156 foreach ($ data as $ v )
156157 {
157- $ members [] = new AgentMember ($ v );
158+ $ members [] = Hydrator:: AgentMember ($ v );
158159 }
159160
160161 return [$ members , null ];
@@ -169,7 +170,7 @@ public function members()
169170 public function serviceRegister (AgentServiceRegistration $ agentServiceRegistration )
170171 {
171172 $ r = new Request ('put ' , 'v1/agent/service/register ' , $ this ->_Config );
172- $ r ->setBody ($ agentServiceRegistration );
173+ $ r ->body = ($ agentServiceRegistration );
173174
174175 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
175176
@@ -238,7 +239,7 @@ public function failTTL($checkID, $note)
238239 public function updateTTL ($ checkID , $ output , $ status )
239240 {
240241 $ r = new Request ('put ' , sprintf ('v1/agent/check/update/%s ' , rawurlencode ($ checkID )), $ this ->_Config );
241- $ r ->setBody (new AgentCheckUpdate (['Output ' => $ output , 'Status ' => $ status ]));
242+ $ r ->body = (new AgentCheckUpdate (['Output ' => $ output , 'Status ' => $ status ]));
242243
243244 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
244245
@@ -252,7 +253,7 @@ public function updateTTL($checkID, $output, $status)
252253 public function checkRegister (AgentCheckRegistration $ agentCheckRegistration )
253254 {
254255 $ r = new Request ('put ' , 'v1/agent/check/register ' , $ this ->_Config );
255- $ r ->setBody ($ agentCheckRegistration );
256+ $ r ->body = ($ agentCheckRegistration );
256257
257258 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
258259
@@ -281,7 +282,7 @@ public function join($addr, $wan = false)
281282 {
282283 $ r = new Request ('put ' , sprintf ('v1/agent/join/%s ' , rawurlencode ($ addr )), $ this ->_Config );
283284 if ($ wan )
284- $ r ->params () ->set ('wan ' , 1 );
285+ $ r ->params ->set ('wan ' , 1 );
285286
286287 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
287288
@@ -309,8 +310,8 @@ public function forceLeave($node)
309310 public function enableServiceMaintenance ($ serviceID , $ reason = '' )
310311 {
311312 $ r = new Request ('put ' , sprintf ('v1/agent/service/maintenance/%s ' , rawurlencode ($ serviceID )), $ this ->_Config );
312- $ r ->params () ->set ('enable ' , 'true ' );
313- $ r ->params () ->set ('reason ' , $ reason );
313+ $ r ->params ->set ('enable ' , 'true ' );
314+ $ r ->params ->set ('reason ' , $ reason );
314315
315316 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
316317
@@ -324,7 +325,7 @@ public function enableServiceMaintenance($serviceID, $reason = '')
324325 public function disableServiceMaintenance ($ serviceID )
325326 {
326327 $ r = new Request ('put ' , sprintf ('v1/agent/service/maintenance/%s ' , rawurlencode ($ serviceID )), $ this ->_Config );
327- $ r ->params () ->set ('enable ' , 'false ' );
328+ $ r ->params ->set ('enable ' , 'false ' );
328329
329330 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
330331
@@ -338,8 +339,8 @@ public function disableServiceMaintenance($serviceID)
338339 public function enableNodeMaintenance ($ reason = '' )
339340 {
340341 $ r = new Request ('put ' , 'v1/agent/maintenance ' , $ this ->_Config );
341- $ r ->params () ->set ('enable ' , 'true ' );
342- $ r ->params () ->set ('reason ' , $ reason );
342+ $ r ->params ->set ('enable ' , 'true ' );
343+ $ r ->params ->set ('reason ' , $ reason );
343344
344345 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
345346
@@ -352,7 +353,7 @@ public function enableNodeMaintenance($reason = '')
352353 public function disableNodeMaintenance ()
353354 {
354355 $ r = new Request ('put ' , 'v1/agent/maintenance ' , $ this ->_Config );
355- $ r ->params () ->set ('enable ' , 'false ' );
356+ $ r ->params ->set ('enable ' , 'false ' );
356357
357358 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
358359
@@ -369,7 +370,7 @@ public function disableNodeMaintenance()
369370 public function checkPass ($ checkID , $ note = '' )
370371 {
371372 $ r = new Request ('get ' , sprintf ('v1/agent/check/pass/%s ' , rawurlencode ($ checkID )), $ this ->_Config );
372- $ r ->params () ->set ('note ' , $ note );
373+ $ r ->params ->set ('note ' , $ note );
373374
374375 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
375376
@@ -386,7 +387,7 @@ public function checkPass($checkID, $note = '')
386387 public function checkWarn ($ checkID , $ note = '' )
387388 {
388389 $ r = new Request ('get ' , sprintf ('v1/agent/check/warn/%s ' , rawurlencode ($ checkID )), $ this ->_Config );
389- $ r ->params () ->set ('note ' , $ note );
390+ $ r ->params ->set ('note ' , $ note );
390391
391392 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
392393
@@ -403,7 +404,7 @@ public function checkWarn($checkID, $note = '')
403404 public function checkFail ($ checkID , $ note = '' )
404405 {
405406 $ r = new Request ('get ' , sprintf ('v1/agent/check/fail/%s ' , rawurlencode ($ checkID )), $ this ->_Config );
406- $ r ->params () ->set ('note ' , $ note );
407+ $ r ->params ->set ('note ' , $ note );
407408
408409 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
409410
0 commit comments