DNS::fetch()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
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