HttpClient   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 14 1
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