Http   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 14 2
1
<?php
2
3
namespace PHPieces\Framework\Util;
4
5
class Http
6
{
7
    public function get($url)
8
    {
9
        if (function_exists("curl_init")) {
10
            $ch = curl_init();
11
            curl_setopt($ch, CURLOPT_URL, $url);
12
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
13
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
14
            $content = curl_exec($ch);
15
            curl_close($ch);
16
            return $content;
17
        } else {
18
            return file_get_contents($url);
19
        }
20
    }
21
}
22