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.

Virtual_Dns::modify()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
nc 1
nop 6
1
<?php
2
3
namespace Cloudflare\User;
4
5
use Cloudflare\Api;
6
7
/**
8
 * CloudFlare API wrapper
9
 *
10
 * Virtual DNS (Users)
11
 * User-level Virtual DNS Management
12
 *
13
 * @author James Bell <[email protected]>
14
 *
15
 * @version 1
16
 */
17
class Virtual_Dns extends Api
18
{
19
    /**
20
     * Get Virtual DNS Clusters (permission needed: #dns_records:read)
21
     * List configured Virtual DNS clusters for a user
22
     */
23
    public function clusters()
24
    {
25
        return $this->get('/user/virtual_dns');
26
    }
27
28
    /**
29
     * Create a Virtual DNS Cluster (permission needed: #dns_records:edit)
30
     * Create a configured Virtual DNS Cluster
31
     *
32
     * @param string    $name                  Virtual DNS Cluster Name
33
     * @param array     $origin_ips
34
     * @param int|null  $minimum_cache_ttl     Minimum DNS Cache TTL
35
     * @param int|null  $maximum_cache_ttl     Maximum DNS Cache TTL
36
     * @param bool|null $deprecate_any_request Deprecate the response to ANY requests
37
     */
38
    public function create($name, $origin_ips, $minimum_cache_ttl = null, $maximum_cache_ttl = null, $deprecate_any_request = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        $data = [
41
            'name'                  => $name,
42
            'origin_ips'            => $origin_ips,
43
            'minimum_cache_ttl'     => $minimum_cache_ttl,
44
            'maximum_cache_ttl'     => $maximum_cache_ttl,
45
            'deprecate_any_request' => $deprecate_any_request,
46
        ];
47
48
        return $this->post('/user/virtual_dns', $data);
49
    }
50
51
    /**
52
     * Get a Virtual DNS Cluster (permission needed: #dns_records:read)
53
     * List a single configured Virtual DNS clusters for a user
54
     *
55
     * @param string $identifier Identifier tag
56
     */
57
    public function cluster($identifier)
58
    {
59
        return $this->get('/user/virtual_dns/'.$identifier);
60
    }
61
62
    /**
63
     * Modify a Virtual DNS Cluster
64
     * Modify a Virtual DNS Cluster configuration (permission needed: #dns_records:edit)
65
     *
66
     * @param string $identifier            Identifier tag
67
     * @param string $name                  Virtual DNS Cluster Name
68
     * @param array  $origin_ips
69
     * @param int    $minimum_cache_ttl     Minimum DNS Cache TTL
70
     * @param int    $maximum_cache_ttl     Maximum DNS Cache TTL
71
     * @param bool   $deprecate_any_request Deprecate the response to ANY requests
72
     */
73
    public function modify($identifier, $name, $origin_ips, $minimum_cache_ttl, $maximum_cache_ttl, $deprecate_any_request)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
74
    {
75
        $data = [
76
            'name'                  => $name,
77
            'origin_ips'            => $origin_ips,
78
            'minimum_cache_ttl'     => $minimum_cache_ttl,
79
            'maximum_cache_ttl'     => $maximum_cache_ttl,
80
            'deprecate_any_request' => $deprecate_any_request,
81
        ];
82
83
        return $this->patch('/user/virtual_dns/'.$identifier, $data);
84
    }
85
86
    /**
87
     * Delete a Virtual DNS Cluster (permission needed: #dns_records:edit)
88
     * Delete a configured Virtual DNS cluster
89
     *
90
     * @param string $identifier Identifier tag
91
     */
92
    public function delete_cluster($identifier)
93
    {
94
        return $this->delete('/user/virtual_dns/'.$identifier);
95
    }
96
}
97