@@ -53,7 +53,7 @@ abstract class AbstractApi implements ApiInterface
5353 public function __construct (Client $ client , int $ perPage = null )
5454 {
5555 if (null !== $ perPage && ($ perPage < 1 || $ perPage > 100 )) {
56- throw new ValueError (sprintf ('%s::__construct(): Argument #2 ($perPage) must be between 1 and 100, or null ' , self ::class));
56+ throw new ValueError (\ sprintf ('%s::__construct(): Argument #2 ($perPage) must be between 1 and 100, or null ' , self ::class));
5757 }
5858
5959 $ this ->client = $ client ;
@@ -72,7 +72,7 @@ public function __construct(Client $client, int $perPage = null)
7272 public function perPage (?int $ perPage )
7373 {
7474 if (null !== $ perPage && ($ perPage < 1 || $ perPage > 100 )) {
75- throw new ValueError (sprintf ('%s::perPage(): Argument #1 ($perPage) must be between 1 and 100, or null ' , self ::class));
75+ throw new ValueError (\ sprintf ('%s::perPage(): Argument #1 ($perPage) must be between 1 and 100, or null ' , self ::class));
7676 }
7777
7878 $ copy = clone $ this ;
@@ -126,7 +126,7 @@ protected function get($uri, array $params = [], array $headers = [])
126126 */
127127 protected function post ($ uri , array $ params = [], array $ headers = [], array $ files = [])
128128 {
129- if (0 < count ($ files )) {
129+ if (0 < \ count ($ files )) {
130130 $ builder = $ this ->createMultipartStreamBuilder ($ params , $ files );
131131 $ body = self ::prepareMultipartBody ($ builder );
132132 $ headers = self ::addMultipartContentType ($ headers , $ builder );
@@ -153,7 +153,7 @@ protected function post($uri, array $params = [], array $headers = [], array $fi
153153 */
154154 protected function put ($ uri , array $ params = [], array $ headers = [], array $ files = [])
155155 {
156- if (0 < count ($ files )) {
156+ if (0 < \ count ($ files )) {
157157 $ builder = $ this ->createMultipartStreamBuilder ($ params , $ files );
158158 $ body = self ::prepareMultipartBody ($ builder );
159159 $ headers = self ::addMultipartContentType ($ headers , $ builder );
@@ -197,7 +197,7 @@ protected function delete($uri, array $params = [], array $headers = [])
197197 */
198198 protected static function encodePath ($ uri )
199199 {
200- return rawurlencode ((string ) $ uri );
200+ return \ rawurlencode ((string ) $ uri );
201201 }
202202
203203 /**
@@ -256,11 +256,11 @@ protected function createOptionsResolver()
256256 */
257257 private static function prepareUri (string $ uri , array $ query = [])
258258 {
259- $ query = array_filter ($ query , function ($ value ): bool {
259+ $ query = \ array_filter ($ query , function ($ value ): bool {
260260 return null !== $ value ;
261261 });
262262
263- return sprintf ('%s%s%s ' , self ::URI_PREFIX , $ uri , QueryStringBuilder::build ($ query ));
263+ return \ sprintf ('%s%s%s ' , self ::URI_PREFIX , $ uri , QueryStringBuilder::build ($ query ));
264264 }
265265
266266 /**
@@ -284,7 +284,7 @@ private function createMultipartStreamBuilder(array $params = [], array $files =
284284 'headers ' => [
285285 'Content-Type ' => self ::guessFileContentType ($ file ),
286286 ],
287- 'filename ' => basename ($ file ),
287+ 'filename ' => \ basename ($ file ),
288288 ]);
289289 }
290290
@@ -313,9 +313,9 @@ private static function prepareMultipartBody(MultipartStreamBuilder $builder)
313313 */
314314 private static function addMultipartContentType (array $ headers , MultipartStreamBuilder $ builder )
315315 {
316- $ contentType = sprintf ('%s; boundary=%s ' , ResponseMediator::MULTIPART_CONTENT_TYPE , $ builder ->getBoundary ());
316+ $ contentType = \ sprintf ('%s; boundary=%s ' , ResponseMediator::MULTIPART_CONTENT_TYPE , $ builder ->getBoundary ());
317317
318- return array_merge (['Content-Type ' => $ contentType ], $ headers );
318+ return \ array_merge (['Content-Type ' => $ contentType ], $ headers );
319319 }
320320
321321 /**
@@ -327,11 +327,11 @@ private static function addMultipartContentType(array $headers, MultipartStreamB
327327 */
328328 private static function prepareJsonBody (array $ params )
329329 {
330- $ params = array_filter ($ params , function ($ value ): bool {
330+ $ params = \ array_filter ($ params , function ($ value ): bool {
331331 return null !== $ value ;
332332 });
333333
334- if (0 === count ($ params )) {
334+ if (0 === \ count ($ params )) {
335335 return null ;
336336 }
337337
@@ -347,7 +347,7 @@ private static function prepareJsonBody(array $params)
347347 */
348348 private static function addJsonContentType (array $ headers )
349349 {
350- return array_merge (['Content-Type ' => ResponseMediator::JSON_CONTENT_TYPE ], $ headers );
350+ return \ array_merge (['Content-Type ' => ResponseMediator::JSON_CONTENT_TYPE ], $ headers );
351351 }
352352
353353 /**
@@ -368,17 +368,17 @@ private static function addJsonContentType(array $headers)
368368 private static function tryFopen ($ filename , $ mode )
369369 {
370370 $ ex = null ;
371- set_error_handler (function () use ($ filename , $ mode , &$ ex ) {
372- $ ex = new RuntimeException (sprintf (
371+ \ set_error_handler (function () use ($ filename , $ mode , &$ ex ) {
372+ $ ex = new RuntimeException (\ sprintf (
373373 'Unable to open %s using mode %s: %s ' ,
374374 $ filename ,
375375 $ mode ,
376- func_get_args ()[1 ]
376+ \ func_get_args ()[1 ]
377377 ));
378378 });
379379
380- $ handle = fopen ($ filename , $ mode );
381- restore_error_handler ();
380+ $ handle = \ fopen ($ filename , $ mode );
381+ \ restore_error_handler ();
382382
383383 if (null !== $ ex ) {
384384 throw $ ex ;
@@ -397,7 +397,7 @@ private static function tryFopen($filename, $mode)
397397 */
398398 private static function guessFileContentType (string $ file )
399399 {
400- if (!class_exists (\finfo::class, false )) {
400+ if (!\ class_exists (\finfo::class, false )) {
401401 return ResponseMediator::STREAM_CONTENT_TYPE ;
402402 }
403403
0 commit comments