HttpClient::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace Netgen\Bundle\OpenWeatherMapBundle\Http;
4
5
/**
6
 * Class HttpClient.
7
 */
8
class HttpClient implements HttpClientInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function get($url)
14
    {
15
        $curlHandle = curl_init();
16
        curl_setopt($curlHandle, CURLOPT_URL, $url);
17
        curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
18
        curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, true);
19
20
        $response = curl_exec($curlHandle);
21
        $httpCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
22
23
        curl_close($curlHandle);
24
25
        return new JsonResponse($response, $httpCode);
26
    }
27
}
28