1414use GuzzleHttp \Exception \ClientException ;
1515use Psr \Http \Message \RequestInterface ;
1616use Psr \Log \LoggerInterface ;
17+ use function GuzzleHttp \json_decode as guzzle_json_decode ;
1718
1819/**
1920 * Abstract client for common code for the different clients.
@@ -58,7 +59,7 @@ abstract class BaseClient
5859 * @param LoggerInterface|null $logger
5960 * @param HttpClient|null $httpClient
6061 */
61- public function __construct ($ accessToken , $ host , LoggerInterface $ logger = null , HttpClient $ httpClient = null )
62+ public function __construct ($ accessToken , $ host , LoggerInterface $ logger = \ null, HttpClient $ httpClient = \ null)
6263 {
6364 $ this ->logger = $ logger ?: new NullLogger ();
6465 $ this ->httpClient = $ httpClient ?: new HttpClient ();
@@ -88,7 +89,7 @@ public function __construct($accessToken, $host, LoggerInterface $logger = null,
8889 *
8990 * @return $this
9091 */
91- public function setApplication ($ name , $ version = null )
92+ public function setApplication ($ name , $ version = \ null)
9293 {
9394 $ this ->userAgentGenerator ->setApplication ($ name , $ version );
9495
@@ -103,7 +104,7 @@ public function setApplication($name, $version = null)
103104 *
104105 * @return $this
105106 */
106- public function setIntegration ($ name , $ version = null )
107+ public function setIntegration ($ name , $ version = \ null)
107108 {
108109 $ this ->userAgentGenerator ->setIntegration ($ name , $ version );
109110
@@ -151,10 +152,10 @@ protected function request($method, $path, array $options = [])
151152
152153 $ body = $ message ->getResponse ()
153154 ? (string ) $ message ->getResponse ()->getBody ()
154- : null ;
155+ : \ null;
155156
156157 return $ body
157- ? \ GuzzleHttp \json_decode ((string ) $ body , true )
158+ ? guzzle_json_decode ((string ) $ body , \ true)
158159 : [];
159160 }
160161
@@ -168,20 +169,20 @@ protected function request($method, $path, array $options = [])
168169 */
169170 private function callApi (RequestInterface $ request )
170171 {
171- $ startTime = \microtime (true );
172+ $ startTime = \microtime (\ true);
172173
173- $ exception = null ;
174+ $ exception = \ null;
174175 try {
175176 $ response = $ this ->httpClient ->send ($ request );
176177 } catch (ClientException $ exception ) {
177178 $ response = $ exception ->hasResponse ()
178179 ? $ exception ->getResponse ()
179- : null ;
180+ : \ null;
180181
181182 $ exception = $ this ->createCustomException ($ exception );
182183 }
183184
184- $ duration = \microtime (true ) - $ startTime ;
185+ $ duration = \microtime (\ true) - $ startTime ;
185186
186187 return new Message (
187188 $ this ->getApi (),
@@ -202,10 +203,10 @@ private function callApi(RequestInterface $request)
202203 */
203204 private function createCustomException (ClientException $ exception )
204205 {
205- $ errorId = null ;
206+ $ errorId = \ null;
206207 $ response = $ exception ->getResponse ();
207208 if ($ response ) {
208- $ data = \ GuzzleHttp \json_decode ($ response ->getBody (), true );
209+ $ data = guzzle_json_decode ($ response ->getBody (), \ true);
209210 $ errorId = $ data ['sys ' ]['id ' ];
210211 }
211212
@@ -246,7 +247,7 @@ private function getExceptionClass($apiError)
246247 */
247248 protected function getExceptionNamespace ()
248249 {
249- return null ;
250+ return \ null;
250251 }
251252
252253 /**
0 commit comments