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 ( 252fdf...fc0ad3 )
by James
02:05
created

Monitors::delete_monitor()   A

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\Organizations\LoadBalancers;
4
5
use Cloudflare\Api;
6
use Cloudflare\Organizations;
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
     * @param string $organization_identifier
25
     */
26
    public function monitors($organization_identifier)
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...
27
    {
28
        return $this->get('/organizations/'.$organization_identifier.'/load_balancers/monitors');
29
    }
30
31
    /**
32
     * Create a monitor
33
     * Create a configured monitor
34
     *
35
     * @param string      $organization_identifier
36
     * @param string      $expected_body           A case-insensitive substring to match in the body of the probe
37
     *                                             response to declare an origin as up
38
     * @param string      $expected_codes          The expected HTTP response code or code range for the probe
39
     * @param string|null $method                  The HTTP method to use for the health check.
40
     * @param int|null    $timeout                 The timeout (in seconds) before marking the health check as failed
41
     * @param string|null $path                    The endpoint path to health check against.
42
     * @param int|null    $interval                The interval between each health check. Shorter intervals may improve failover
43
     *                                             time, but will increase load on the origins as we check from multiple locations.
44
     * @param int|null    $retries                 The number of retries to attempt in case of a timeout before marking the origin
45
     *                                             as unhealthy. Retries are attempted immediately.
46
     * @param array|null  $header                  The HTTP request headers to send in the health check. It is recommended you set
47
     *                                             a Host header by default. The User-Agent header cannot be overridden.
48
     * @param int|null    $type                    The protocol to use for the healthcheck. Currently supported protocols are
49
     *                                             'HTTP' and 'HTTPS'.
50
     * @param string|null $description             Object description
51
     */
52 View Code Duplication
    public function create($organization_identifier, $expected_body, $expected_codes, $method = null, $timeout = null, $path = null, $interval = null, $retries = null, $header = null, $type = null, $description = 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...
53
    {
54
        $data = [
55
            'expected_body'  => $expected_body,
56
            'expected_codes' => $expected_codes,
57
            'method'         => $method,
58
            'timeout'        => $timeout,
59
            'path'           => $path,
60
            'interval'       => $interval,
61
            'retries'        => $retries,
62
            'header'         => $header,
63
            'type'           => $type,
64
            'description'    => $description,
65
        ];
66
67
        return $this->post('/organizations/'.$organization_identifier.'/load_balancers/monitors', $data);
68
    }
69
70
    /**
71
     * Monitor details
72
     * List a single configured CTM monitor for a user
73
     *
74
     * @param string $organization_identifier
75
     * @param string $identifier
76
     */
77
    public function details($organization_identifier, $identifier)
78
    {
79
        return $this->get('/organizations/'.$organization_identifier.'/load_balancers/monitors/'.$identifier);
80
    }
81
82
    /**
83
     * Modify a monitor
84
     * Modify a configured monitor
85
     *
86
     * @param string      $organization_identifier
87
     * @param string      $identifier
88
     * @param string      $expected_body           A case-insensitive substring to match in the body of the probe
89
     *                                             response to declare an origin as up
90
     * @param string      $expected_codes          The expected HTTP response code or code range for the probe
91
     * @param string|null $method                  The HTTP method to use for the health check.
92
     * @param int|null    $timeout                 The timeout (in seconds) before marking the health check as failed
93
     * @param string|null $path                    The endpoint path to health check against.
94
     * @param int|null    $interval                The interval between each health check. Shorter intervals may improve failover
95
     *                                             time, but will increase load on the origins as we check from multiple locations.
96
     * @param int|null    $retries                 The number of retries to attempt in case of a timeout before marking the origin
97
     *                                             as unhealthy. Retries are attempted immediately.
98
     * @param array|null  $header                  The HTTP request headers to send in the health check. It is recommended you set
99
     *                                             a Host header by default. The User-Agent header cannot be overridden.
100
     * @param int|null    $type                    The protocol to use for the healthcheck. Currently supported protocols are
101
     *                                             'HTTP' and 'HTTPS'.
102
     * @param string|null $description             Object description
103
     */
104 View Code Duplication
    public function update($organization_identifier, $identifier, $expected_body, $expected_codes, $method = null, $timeout = null, $path = null, $interval = null, $retries = null, $header = null, $type = null, $description = 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...
105
    {
106
        $data = [
107
            'expected_body'  => $expected_body,
108
            'expected_codes' => $expected_codes,
109
            'method'         => $method,
110
            'timeout'        => $timeout,
111
            'path'           => $path,
112
            'interval'       => $interval,
113
            'retries'        => $retries,
114
            'header'         => $header,
115
            'type'           => $type,
116
            'description'    => $description,
117
        ];
118
119
        return $this->patch('/organizations/'.$organization_identifier.'/load_balancers/monitors/'.$identifier, $data);
120
    }
121
122
    /**
123
     * Delete a monitor
124
     * Delete a configured monitor
125
     *
126
     * @param string $organization_identifier
127
     * @param string $identifier
128
     */
129
    public function delete_monitor($organization_identifier, $identifier)
130
    {
131
        return $this->delete('/organizations/'.$organization_identifier.'/load_balancers/monitors/'.$identifier);
132
    }
133
}
134