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 ( 229871...9bb09c )
by James
02:41
created

Organizations/Firewall/AccessRules/Rules.php (8 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Cloudflare\Organizations\Firewall\AccessRules;
4
5
use Cloudflare\Api;
6
use Cloudflare\Organizations;
7
use Cloudflare\Organizations\Firewall;
8
9
/**
10
 * CloudFlare API wrapper
11
 *
12
 * Organization-level Firewall access rule
13
 *
14
 * @author James Bell <[email protected]>
15
 *
16
 * @version 1
17
 */
18
class Rules extends Api
19
{
20
    /**
21
     * Default permissions level
22
     *
23
     * @var array
24
     */
25
    protected $permission_level = ['read' => '#organization:read', 'edit' => '#organization:edit'];
26
27
    /**
28
     * List access rules (permission needed: #organization:read)
29
     * Search, sort, and filter IP/country access rules
30
     *
31
     * @param string      $organization_id
32
     * @param string|null $mode                 The action to apply to a matched request
33
     * @param string|null $configuration_target The rule configuration target
34
     * @param string|null $configuration_value  Search by IP, range, or country code
35
     * @param int|null    $page                 Page number of paginated results
36
     * @param int|null    $per_page             Number of rules per page
37
     * @param string|null $order                Field to order rules by
38
     * @param string|null $direction            Direction to order rules
39
     * @param string|null $match                Whether to match all search requirements or at least one (any)
40
     */
41
    public function rules($organization_id, $mode = null, $configuration_target = null, $configuration_value = null, $page = null, $per_page = null, $order = null, $direction = null, $match = null)
0 ignored issues
show
The parameter $mode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $configuration_target is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $configuration_value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $page is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $per_page is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $order is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $direction is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $match is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        return $this->get('organizations/'.$organization_id.'/firewall/access_rules/rules');
44
    }
45
46
    /**
47
     * Create access rule (permission needed: #organization:edit)
48
     * Make a new IP, IP range, or country access rule for all zones owned by the organization.
49
     * Note: If you would like to create an access rule that applies to a specific zone only, use the zone firewall endpoints.
50
     *
51
     * @param string      $organization_id
52
     * @param string      $mode            The action to apply to a matched request
53
     * @param object      $configuration   Rule configuration
54
     * @param string|null $notes           A personal note about the rule. Typically used as a reminder or explanation for the rule.
55
     */
56
    public function create($organization_id, $mode, $configuration, $notes = null)
57
    {
58
        $data = [
59
            'mode'          => $mode,
60
            'configuration' => $configuration,
61
            'notes'         => $notes,
62
        ];
63
64
        return $this->post('organizations/'.$organization_id.'/firewall/access_rules/rules', $data);
65
    }
66
67
    /**
68
     * Update access rule (permission needed: #organization:edit)
69
     * Update rule state and/or configuration. This will be applied across all zones owned by the organization.
70
     *
71
     * @param string      $organization_id
72
     * @param string      $identifier
73
     * @param string|null $mode            The action to apply to a matched request
74
     * @param object|null $configuration   Rule configuration
75
     * @param string|null $notes           A personal note about the rule. Typically used as a reminder or explanation for the rule.
76
     */
77
    public function update($organization_id, $identifier, $mode = null, $configuration = null, $notes = null)
78
    {
79
        $data = [
80
            'mode'          => $mode,
81
            'configuration' => $configuration,
82
            'notes'         => $notes,
83
        ];
84
85
        return $this->patch('organizations/'.$organization_id.'/firewall/access_rules/rules/'.$identifier, $data);
86
    }
87
88
    /**
89
     * Delete access rule (permission needed: #organization:edit)
90
     * Remove an access rule so it is no longer evaluated during requests. This will apply to all zones owned by the organization
91
     *
92
     * @param string $organization_id
93
     * @param string $identifier
94
     */
95
    public function delete_rule($organization_id, $identifier)
96
    {
97
        return $this->delete('organizations/'.$organization_id.'/firewall/access_rules/rules/'.$identifier);
98
    }
99
}
100