DNS   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fetch() 0 11 2
A getURL() 0 4 1
1
<?php
2
/*
3
 * @author Chris Hilsdon <[email protected]>
4
 *
5
 * @link https://api.cloudflare.com/#zone
6
 */
7
namespace Cloudflare;
8
9
class DNS extends Base
10
{
11
    protected $URL = "zones/%s/dns_records";
12
    protected $zone;
13
14
    public function __construct($cloudflare, $zone)
15
    {
16
        parent::__construct($cloudflare);
17
        $this->zone = $zone;
18
    }
19
20
    /*
21
     *
22
     * @link https://api.cloudflare.com/#zone-list-zones
23
     */
24
    public function fetch()
25
    {
26
        $this->makeRequest($this->getURL());
27
        $response = $this->getResponse();
28
29
        if($response->success != true) {
30
            return false;
31
        }
32
33
        return $response->result;
34
    }
35
36
    private function getURL()
37
    {
38
        return sprintf($this->URL, $this->zone);
39
    }
40
}
41