Passed
Push — main ( 191161...deb0a6 )
by Aron
02:36
created

Curl::curl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace artes\Curl;
4
5
/**
6
  * A class for curl requests
7
  *
8
  * @SuppressWarnings(PHPMD)
9
  */
10
class Curl
11
{
12
    /**
13
     *
14
     * @param string $url
15
     *
16
     */
17
18 14
    public function curl($url)
19
    {
20 14
        $ch = curl_init();
21 14
        curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_URL, $url);
22 14
        curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_RETURNTRANSFER, 1);
23 14
        $apiresponse = curl_exec(/** @scrutinizer ignore-type */ $ch);
24
25 14
        $jsonresp = json_decode($apiresponse, /** @scrutinizer ignore-type */ JSON_UNESCAPED_UNICODE);
26 14
        return $jsonresp;
27
    }
28
}
29