Client::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 18
ccs 0
cts 13
cp 0
rs 9.4285
cc 2
eloc 13
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Dekalee\AdbackAnalytics\Client;
4
5
/**
6
 * Class Client
7
 */
8
class Client
9
{
10
    /**
11
     * @param $url
12
     *
13
     * @return Response
14
     */
15
    public function get($url)
16
    {
17
        if (function_exists('curl_version')) {
18
            $curl = curl_init($url);
19
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
20
            curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
21
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
22
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
23
            $data = curl_exec($curl);
24
            curl_close($curl);
25
        } else {
26
            $data = @file_get_contents($url);
27
        }
28
29
        $response = new Response($data);
30
31
        return $response;
32
    }
33
}
34