@@ -41,10 +41,10 @@ public function self()
4141
4242 /** @var \Psr\Http\Message\ResponseInterface $response */
4343 list ($ duration , $ response , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
44- $ qm = $ this ->buildQueryMeta ($ duration , $ response , $ r ->getUri ());
45-
4644 if (null !== $ err )
47- return [null , $ qm , $ err ];
45+ return [null , null , $ err ];
46+
47+ $ qm = $ this ->buildQueryMeta ($ duration , $ response , $ r ->getUri ());
4848
4949 list ($ data , $ err ) = $ this ->decodeBody ($ response ->getBody ());
5050
@@ -95,7 +95,7 @@ public function checks()
9595 if (null !== $ err )
9696 return [null , $ err ];
9797
98- $ checks = array () ;
98+ $ checks = [] ;
9999 foreach ($ data as $ k => $ v )
100100 {
101101 $ checks [$ k ] = new AgentCheck ($ v );
@@ -125,7 +125,7 @@ public function services()
125125 if (null !== $ err )
126126 return [null , $ err ];
127127
128- $ services = array () ;
128+ $ services = [] ;
129129 foreach ($ data as $ k => $ v )
130130 {
131131 $ services [$ k ] = new AgentService ($ v );
@@ -155,7 +155,7 @@ public function members()
155155 if (null !== $ err )
156156 return [null , $ err ];
157157
158- $ members = array () ;
158+ $ members = [] ;
159159 foreach ($ data as $ v )
160160 {
161161 $ members [] = new AgentMember ($ v );
@@ -172,8 +172,7 @@ public function members()
172172 */
173173 public function serviceRegister (AgentServiceRegistration $ agentServiceRegistration )
174174 {
175- $ r = new Request ('put ' , 'v1/agent/service/register ' , $ this ->c );
176- $ r ->body = ($ agentServiceRegistration );
175+ $ r = new Request ('put ' , 'v1/agent/service/register ' , $ this ->c , $ agentServiceRegistration );
177176
178177 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
179178
@@ -241,8 +240,7 @@ public function failTTL($checkID, $note)
241240 */
242241 public function updateTTL ($ checkID , $ output , $ status )
243242 {
244- $ r = new Request ('put ' , sprintf ('v1/agent/check/update/%s ' , $ checkID ), $ this ->c );
245- $ r ->body = (new AgentCheckUpdate (['Output ' => $ output , 'Status ' => $ status ]));
243+ $ r = new Request ('put ' , sprintf ('v1/agent/check/update/%s ' , $ checkID ), $ this ->c , new AgentCheckUpdate (['Output ' => $ output , 'Status ' => $ status ]));
246244
247245 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
248246
@@ -255,8 +253,7 @@ public function updateTTL($checkID, $output, $status)
255253 */
256254 public function checkRegister (AgentCheckRegistration $ agentCheckRegistration )
257255 {
258- $ r = new Request ('put ' , 'v1/agent/check/register ' , $ this ->c );
259- $ r ->body = ($ agentCheckRegistration );
256+ $ r = new Request ('put ' , 'v1/agent/check/register ' , $ this ->c , $ agentCheckRegistration );
260257
261258 list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
262259
@@ -363,57 +360,6 @@ public function disableNodeMaintenance()
363360 return $ err ;
364361 }
365362
366- /**
367- * Set non-ttl check's state to passing with optional note
368- *
369- * @param string $checkID
370- * @param string $note
371- * @return \DCarbone\PHPConsulAPI\Error|null
372- */
373- public function checkPass ($ checkID , $ note = '' )
374- {
375- $ r = new Request ('get ' , sprintf ('v1/agent/check/pass/%s ' , $ checkID ), $ this ->c );
376- $ r ->params ->set ('note ' , $ note );
377-
378- list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
379-
380- return $ err ;
381- }
382-
383- /**
384- * Set non-ttl check's state to warning with optional note
385- *
386- * @param string $checkID
387- * @param string $note
388- * @return \DCarbone\PHPConsulAPI\Error|null
389- */
390- public function checkWarn ($ checkID , $ note = '' )
391- {
392- $ r = new Request ('get ' , sprintf ('v1/agent/check/warn/%s ' , $ checkID ), $ this ->c );
393- $ r ->params ->set ('note ' , $ note );
394-
395- list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
396-
397- return $ err ;
398- }
399-
400- /**
401- * Set non-ttl check's state to critical with optional note
402- *
403- * @param string $checkID
404- * @param string $note
405- * @return \DCarbone\PHPConsulAPI\Error|null
406- */
407- public function checkFail ($ checkID , $ note = '' )
408- {
409- $ r = new Request ('get ' , sprintf ('v1/agent/check/fail/%s ' , $ checkID ), $ this ->c );
410- $ r ->params ->set ('note ' , $ note );
411-
412- list ($ _ , $ _ , $ err ) = $ this ->requireOK ($ this ->doRequest ($ r ));
413-
414- return $ err ;
415- }
416-
417363 /**
418364 * @return \DCarbone\PHPConsulAPI\Error|null
419365 */
0 commit comments