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.

Pools::delete_pool()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 2
b 0
f 0
cc 1
eloc 2
nc 1
nop 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 Pool
12
 * User-level Cloud Traffic Manager Pool
13
 *
14
 * @author James Bell <[email protected]>
15
 *
16
 * @version 1
17
 */
18
class Pools extends Api
19
{
20
    /**
21
     * List pools
22
     * List configured pools
23
     */
24
    public function pools()
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/pools');
27
    }
28
29
    /**
30
     * Create a pool
31
     * Create a new pool
32
     *
33
     * @param string      $name               Object name
34
     * @param array       $origins            A list of origins contained in the pool.
35
     *                                        Traffic destined to the pool is balanced across all
36
     *                                        available origins contained in the pool (as long as the pool
37
     *                                        is considered available).
38
     * @param string|null $description        Object description
39
     * @param bool|null   $enabled            Whether this pool is enabled or not.
40
     * @param string|null $monitor            ID of the monitor object to use for monitoring the health
41
     *                                        status of origins inside this pool.
42
     * @param string|null $notification_email ID of the notifier object to use for notifications relating
43
     *                                        to the health status of origins inside this pool.
44
     */
45
    public function create($name, $origins, $description = null, $enabled = null, $monitor = null, $notification_email = null)
46
    {
47
        $data = [
48
            'name'               => $name,
49
            'origins'            => $origins,
50
            'description'        => $description,
51
            'enabled'            => $enabled,
52
            'monitor'            => $monitor,
53
            'notification_email' => $notification_email,
54
        ];
55
56
        return $this->post('/user/load_balancers/pools', $data);
57
    }
58
59
    /**
60
     * Pool details
61
     * Fetch a single configured pool
62
     *
63
     * @param string $identifier
64
     */
65
    public function details($identifier)
66
    {
67
        return $this->get('/user/load_balancers/pools/'.$identifier);
68
    }
69
70
    /**
71
     * Modify a pool
72
     * Modify a configured pool
73
     *
74
     * @param string      $identifier
75
     * @param string      $name               Object name
76
     * @param array       $origins            A list of origins contained in the pool.
77
     *                                        Traffic destined to the pool is balanced across all
78
     *                                        available origins contained in the pool (as long as the pool
79
     *                                        is considered available).
80
     * @param string|null $description        Object description
81
     * @param bool|null   $enabled            Whether this pool is enabled or not.
82
     * @param string|null $monitor            ID of the monitor object to use for monitoring the health
83
     *                                        status of origins inside this pool.
84
     * @param string|null $notification_email ID of the notifier object to use for notifications relating
85
     *                                        to the health status of origins inside this pool.
86
     */
87 View Code Duplication
    public function update($identifier, $name, $origins, $description = null, $enabled = null, $monitor = null, $notification_email = 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...
88
    {
89
        $data = [
90
            'name'               => $name,
91
            'origins'            => $origins,
92
            'description'        => $description,
93
            'enabled'            => $enabled,
94
            'monitor'            => $monitor,
95
            'notification_email' => $notification_email,
96
        ];
97
98
        return $this->patch('/user/load_balancers/pools/'.$identifier, $data);
99
    }
100
101
    /**
102
     * Delete a pool
103
     * Delete a configured pool
104
     *
105
     * @param string $identifier
106
     */
107
    public function delete_pool($identifier)
108
    {
109
        return $this->delete('/user/load_balancers/pools/'.$identifier);
110
    }
111
}
112