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.
Completed
Push — master ( 5e838e...5ac056 )
by James
04:17 queued 02:02
created

Monitors   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A monitors() 0 4 1
A create() 0 17 1
A details() 0 4 1
A update() 0 17 1
A delete_monitor() 0 4 1
1
<?php
2
3
namespace Cloudflare\User\LoadBalancers;
4
5
use Cloudflare\Api;
6
use Cloudflare\User;
7
8
/**
9
 * CloudFlare API wrapper
10
 *
11
 * CTM Monitors
12
 * Cloud Traffic Manager Monitor
13
 *
14
 * @author James Bell <[email protected]>
15
 *
16
 * @version 1
17
 */
18
class Monitors extends Api
19
{
20
    /**
21
     * List monitors
22
     * List configured monitors for a user
23
     */
24
    public function monitors()
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
25
    {
26
        return $this->get('/user/load_balancers/monitors');
27
    }
28
29
    /**
30
     * Create a monitor
31
     * Create a configured monitor
32
     *
33
     * @param string      $expected       A case-insensitive substring to match in the body of the probe
34
     *                                    response to declare an origin as up
35
     * @param string      $type           Monitor type
36
     * @param string      $expected_codes The expected HTTP response code or code range for the probe
37
     * @param string|null $method         The HTTP method for the probe
38
     * @param string|null $path           The endpoint path to probe
39
     * @param int|null    $interval       The interval in seconds for each PoP to send a probe request
40
     * @param int|null    $retries        The number of retries before declaring the origins to be dead
41
     * @param array|null  $headers        The HTTP headers to use in the probe
42
     * @param int|null    $probe_timeout  Timeout in seconds for each probe request
43
     * @param string|null $description    Object description
44
     */
45
    public function create($expected, $type, $expected_codes, $method = null, $path = null, $interval = null, $retries = null, $headers = null, $probe_timeout = null, $description = null)
46
    {
47
        $data = [
48
            'expected'       => $expected,
49
            'type'           => $type,
50
            'expected_codes' => $expected_codes,
51
            'method'         => $method,
52
            'path'           => $path,
53
            'interval'       => $interval,
54
            'retries'        => $retries,
55
            'headers'        => $headers,
56
            'probe_timeout'  => $probe_timeout,
57
            'description'    => $description,
58
        ];
59
60
        return $this->post('/user/load_balancers/monitors', $data);
61
    }
62
63
    /**
64
     * Monitor details
65
     * List a single configured CTM monitor for a user
66
     *
67
     * @param string $identifier
68
     */
69
    public function details($identifier)
70
    {
71
        return $this->get('/user/load_balancers/monitors/'.$identifier);
72
    }
73
74
    /**
75
     * Modify a monitor
76
     * Modify a configured monitor
77
     *
78
     * @param string      $identifier
79
     * @param string|null $expected       A case-insensitive substring to match in the body of the probe
80
     *                                    response to declare an origin as up
81
     * @param string|null $type           Monitor type
82
     * @param string|null $expected_codes The expected HTTP response code or code range for the probe
83
     * @param string|null $method         The HTTP method for the probe
84
     * @param string|null $path           The endpoint path to probe
85
     * @param int|null    $interval       The interval in seconds for each PoP to send a probe request
86
     * @param int|null    $retries        The number of retries before declaring the origins to be dead
87
     * @param array|null  $headers        The HTTP headers to use in the probe
88
     * @param int|null    $probe_timeout  Timeout in seconds for each probe request
89
     * @param string|null $description    Object description
90
     */
91
    public function update($identifier, $expected = null, $type = null, $expected_codes = null, $method = null, $path = null, $interval = null, $retries = null, $headers = null, $probe_timeout = null, $description = null)
92
    {
93
        $data = [
94
            'expected'       => $expected,
95
            'type'           => $type,
96
            'expected_codes' => $expected_codes,
97
            'method'         => $method,
98
            'path'           => $path,
99
            'interval'       => $interval,
100
            'retries'        => $retries,
101
            'headers'        => $headers,
102
            'probe_timeout'  => $probe_timeout,
103
            'description'    => $description,
104
        ];
105
106
        return $this->patch('/user/load_balancers/monitors/'.$identifier, $data);
107
    }
108
109
    /**
110
     * Delete a monitor
111
     * Delete a configured monitor
112
     *
113
     * @param string $identifier
114
     */
115
    public function delete_monitor($identifier)
116
    {
117
        return $this->delete('/user/load_balancers/monitors/'.$identifier);
118
    }
119
}
120