@@ -6,18 +6,18 @@ class CurlService implements ServiceInterface
66{
77 public function get ($ url , $ apiKey )
88 {
9- $ ch = $ this ->curl_init ();
10- $ this ->curl_setopt ($ ch , CURLOPT_URL , $ url );
11- $ this ->curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , true );
12- $ this ->curl_setopt ($ ch , CURLOPT_HTTPHEADER , [
9+ $ handle = $ this ->curl_init ();
10+ $ this ->curl_setopt ($ handle , CURLOPT_URL , $ url );
11+ $ this ->curl_setopt ($ handle , CURLOPT_RETURNTRANSFER , true );
12+ $ this ->curl_setopt ($ handle , CURLOPT_HTTPHEADER , [
1313 sprintf ("x-key: %s " , $ apiKey )
1414 ]);
1515
16- $ response = $ this ->curl_exec ($ ch );
16+ $ response = $ this ->curl_exec ($ handle );
1717
1818 $ res = json_decode (trim ($ response ), true );
19- $ statusCode = $ this ->curl_getinfo ($ ch , CURLINFO_HTTP_CODE );
20- $ this ->curl_close ($ ch );
19+ $ statusCode = $ this ->curl_getinfo ($ handle , CURLINFO_HTTP_CODE );
20+ $ this ->curl_close ($ handle );
2121
2222 if (json_last_error () !== JSON_ERROR_NONE ) {
2323 throw new Exception ('Could not parse response as json ' );
@@ -38,6 +38,7 @@ public function get($url, $apiKey)
3838
3939 /**
4040 * @codeCoverageIgnore
41+ * @SuppressWarnings(PHPMD)
4142 */
4243 protected function curl_init ()
4344 {
@@ -46,33 +47,37 @@ protected function curl_init()
4647
4748 /**
4849 * @codeCoverageIgnore
50+ * @SuppressWarnings(PHPMD)
4951 */
50- protected function curl_setopt ($ ch , $ name , $ opt )
52+ protected function curl_setopt ($ handle , $ name , $ opt )
5153 {
52- return curl_setopt ($ ch , $ name , $ opt );
54+ return curl_setopt ($ handle , $ name , $ opt );
5355 }
5456
5557 /**
5658 * @codeCoverageIgnore
59+ * @SuppressWarnings(PHPMD)
5760 */
58- protected function curl_getinfo ($ ch , $ name )
61+ protected function curl_getinfo ($ handle , $ name )
5962 {
60- return curl_getinfo ($ ch , $ name );
63+ return curl_getinfo ($ handle , $ name );
6164 }
6265
6366 /**
6467 * @codeCoverageIgnore
68+ * @SuppressWarnings(PHPMD)
6569 */
66- protected function curl_exec ($ ch )
70+ protected function curl_exec ($ handle )
6771 {
68- return curl_exec ($ ch );
72+ return curl_exec ($ handle );
6973 }
7074
7175 /**
7276 * @codeCoverageIgnore
77+ * @SuppressWarnings(PHPMD)
7378 */
74- protected function curl_close ($ ch )
79+ protected function curl_close ($ handle )
7580 {
76- return curl_close ($ ch );
81+ return curl_close ($ handle );
7782 }
78- }
83+ }
0 commit comments