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.

Railguns   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 83
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
A railguns() 0 10 1
A details() 0 4 1
A zones() 0 4 1
A enabled() 0 8 1
A delete_railgun() 0 4 1
1
<?php
2
3
namespace Cloudflare;
4
5
/**
6
 * CloudFlare API wrapper
7
 *
8
 * Railguns
9
 * CloudFlare Railgun
10
 *
11
 * @author James Bell <[email protected]>
12
 *
13
 * @version 1
14
 */
15
class Railguns extends Api
16
{
17
    /**
18
     * Create Railgun (permission needed: #railgun:edit)
19
     *
20
     * @param string $name Readable identifier of the railgun
21
     */
22
    public function create($name)
23
    {
24
        $data = [
25
            'name' => $name,
26
        ];
27
28
        return $this->post('railguns', $data);
29
    }
30
31
    /**
32
     * List Railguns (permission needed: #railgun:read)
33
     * List, search, sort and filter your Railguns
34
     *
35
     * @param int|null    $page      Page number of paginated results
36
     * @param int|null    $per_page  Number of items per page
37
     * @param string|null $direction Direction to order Railguns (asc, desc)
38
     */
39
    public function railguns($page = null, $per_page = null, $direction = 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...
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
40
    {
41
        $data = [
42
            'page'      => $page,
43
            'per_page'  => $per_page,
44
            'direction' => $direction,
45
        ];
46
47
        return $this->get('railguns', $data);
48
    }
49
50
    /**
51
     * Railgun details (permission needed: #railgun:read)
52
     *
53
     * @param string $identifier API item identifier tag
54
     */
55
    public function details($identifier)
56
    {
57
        return $this->get('railguns/'.$identifier);
58
    }
59
60
    /**
61
     * Get zones connected to a Railgun (permission needed: #railgun:read)
62
     * The zones that are currently using this Railgun
63
     *
64
     * @param string $identifier API item identifier tag
65
     */
66
    public function zones($identifier)
67
    {
68
        return $this->get('railguns/'.$identifier.'/zones');
69
    }
70
71
    /**
72
     * Enable or disable a Railgun (permission needed: #railgun:edit)
73
     * Enable or disable a Railgun for all zones connected to it
74
     *
75
     * @param string    $identifier API item identifier tag
76
     * @param bool|null $enabled    Flag to determine if the Railgun is accepting connections
77
     */
78
    public function enabled($identifier, $enabled = null)
79
    {
80
        $data = [
81
            'enabled' => $enabled,
82
        ];
83
84
        return $this->patch('railguns/'.$identifier, $data);
85
    }
86
87
    /**
88
     * Delete Railgun (permission needed: #railgun:edit)
89
     * Disable and delete a Railgun. This will immediately disable the Railgun for any connected zones
90
     *
91
     * @param string $identifier API item identifier tag
92
     */
93
    public function delete_railgun($identifier)
94
    {
95
        return $this->delete('railguns/'.$identifier);
96
    }
97
}
98