GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Dns::delete_record()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Cloudflare\Zone;
4
5
use Cloudflare\Api;
6
7
/**
8
 * CloudFlare API wrapper
9
 *
10
 * DNS Record
11
 * CloudFlare DNS records
12
 *
13
 * @author James Bell <[email protected]>
14
 *
15
 * @version 1
16
 */
17
class Dns extends Api
18
{
19
    /**
20
     * Create DNS record (permission needed: #dns_records:edit)
21
     * Create a new DNS record for a zone. See the record object definitions for required attributes for each record type
22
     *
23
     * @param string     $zone_identifier
24
     * @param string     $type            DNS record type (A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF)
25
     * @param string     $name            DNS record name
26
     * @param string     $content         DNS record content
27
     * @param int|null   $ttl             Time to live for DNS record. Value of 1 is 'automatic'
28
     * @param bool|null  $proxied         Whether to proxy the domain through CloudFlare or not
29
     * @param int|null   $priority        MX record priority value
30
     * @param array|null $data            Additional data required for SRV record
31
     */
32
    public function create($zone_identifier, $type, $name, $content, $ttl = null, $proxied = null, $priority = null, $data = null)
33
    {
34
        $data = [
35
            'type'     => strtoupper($type),
36
            'name'     => $name,
37
            'content'  => $content,
38
            'ttl'      => $ttl,
39
            'proxied'  => $proxied,
40
            'priority' => $priority,
41
            'data'     => $data,
42
        ];
43
44
        return $this->post('zones/'.$zone_identifier.'/dns_records', $data);
45
    }
46
47
    /**
48
     * List DNS Records (permission needed: #dns_records:read)
49
     * List, search, sort, and filter a zones' DNS records.
50
     *
51
     * @param string      $zone_identifier
52
     * @param string|null $type                      DNS record type (A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF)
53
     * @param string|null $name                      DNS record name
54
     * @param string|null $content                   DNS record content
55
     * @param string|null $vanity_name_server_record Flag for records that were created for the vanity name server feature (true, false)
56
     * @param int|null    $page                      Page number of paginated results
57
     * @param int|null    $per_page                  Number of DNS records per page
58
     * @param string|null $order                     Field to order records by (type, name, content, ttl, proxied)
59
     * @param string|null $direction                 Direction to order domains (asc, desc)
60
     * @param string|null $match                     Whether to match all search requirements or at least one (any) (any, all)
61
     */
62
    public function list_records($zone_identifier, $type = null, $name = null, $content = null, $vanity_name_server_record = null, $page = null, $per_page = null, $order = null, $direction = null, $match = null)
63
    {
64
        $data = [
65
            'type'                      => $type,
66
            'name'                      => $name,
67
            'content'                   => $content,
68
            'vanity_name_server_record' => $vanity_name_server_record,
69
            'page'                      => $page,
70
            'per_page'                  => $per_page,
71
            'order'                     => $order,
72
            'direction'                 => $direction,
73
            'match'                     => $match,
74
        ];
75
76
        return $this->get('zones/'.$zone_identifier.'/dns_records', $data);
77
    }
78
79
    /**
80
     * DNS record details (permission needed: #dns_records:read)
81
     *
82
     * @param string $zone_identifier
83
     * @param string $identifier      API item identifier tag
84
     */
85
    public function details($zone_identifier, $identifier)
86
    {
87
        return $this->get('zones/'.$zone_identifier.'/dns_records/'.$identifier);
88
    }
89
90
    /**
91
     * Update DNS record (permission needed: #dns_records:edit)
92
     *
93
     * @param string      $zone_identifier
94
     * @param string      $identifier      API item identifier tag
95
     * @param string|null $type            DNS record type (A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF)
96
     * @param string|null $name            DNS record name
97
     * @param string|null $content         DNS record content
98
     * @param string|null $ttl             Time to live for DNS record. Value of 1 is 'automatic'
99
     * @param bool|null   $proxied         Whether to proxy the domain through CloudFlare or not
100
     * @param array|null  $data            Additional data required for SRV record
101
     * @param int|null    $priority        MX record priority value
102
     */
103
    public function update($zone_identifier, $identifier, $type = null, $name = null, $content = null, $ttl = null, $proxied = null, $data = null, $priority = null)
104
    {
105
        $data = [
106
            'type'     => $type,
107
            'name'     => $name,
108
            'content'  => $content,
109
            'ttl'      => $ttl,
110
            'proxied'  => $proxied,
111
            'priority' => $priority,
112
            'data'     => $data,
113
        ];
114
115
        return $this->put('zones/'.$zone_identifier.'/dns_records/'.$identifier, $data);
116
    }
117
118
    /**
119
     * Update DNS record (permission needed: #dns_records:edit)
120
     *
121
     * @param string $zone_identifier
122
     * @param string $identifier      API item identifier tag
123
     */
124
    public function delete_record($zone_identifier, $identifier)
125
    {
126
        return $this->delete('zones/'.$zone_identifier.'/dns_records/'.$identifier);
127
    }
128
}
129