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.

Groups::groups()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 10

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace Cloudflare\Zone\WAF\Packages;
4
5
use Cloudflare\Api;
6
use Cloudflare\Zone;
7
use Cloudflare\Zone\WAF;
8
9
/**
10
 * CloudFlare API wrapper
11
 *
12
 * WAF Rule Groups properties
13
 *
14
 * @author James Bell <[email protected]>
15
 *
16
 * @version 1
17
 */
18 View Code Duplication
class Groups extends Api
0 ignored issues
show
Duplication introduced by
This class 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...
19
{
20
    /**
21
     * List rule groups (permission needed: #zone:read)
22
     * Search, list, and sort rule groups contained within a package
23
     *
24
     * @param string      $zone_identifier
25
     * @param string      $package_identifier
26
     * @param string|null $name               Name of the firewall rule group
27
     * @param string|null $mode               Whether or not the rules contained within this group are configurable/usable
28
     * @param int|null    $rules_count        How many rules are contained within this group
29
     * @param int|null    $page               Page number of paginated results
30
     * @param int|null    $per_page           Number of groups per page
31
     * @param string|null $order              Field to order groups by
32
     * @param string|null $direction          Direction to order groups
33
     * @param string|null $match              Whether to match all search requirements or at least one (any)
34
     */
35
    public function groups($zone_identifier, $package_identifier, $name = null, $mode = null, $rules_count = null, $page = null, $per_page = null, $order = null, $direction = null, $match = null)
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...
36
    {
37
        $data = [
38
            'name'        => $name,
39
            'mode'        => $mode,
40
            'rules_count' => $rules_count,
41
            'page'        => $page,
42
            'per_page'    => $per_page,
43
            'order'       => $order,
44
            'direction'   => $direction,
45
            'match'       => $match,
46
        ];
47
48
        return $this->get('/zones/'.$zone_identifier.'/firewall/waf/packages/'.$package_identifier.'/groups', $data);
49
    }
50
51
    /**
52
     * Rule group info (permission needed: #zone:read)
53
     * Get a single rule group
54
     *
55
     * @param string $zone_identifier
56
     * @param string $package_identifier
57
     * @param string $identifier
58
     */
59
    public function info($zone_identifier, $package_identifier, $identifier)
60
    {
61
        return $this->get('/zones/'.$zone_identifier.'/firewall/waf/packages/'.$package_identifier.'/groups/'.$identifier);
62
    }
63
64
    /**
65
     * Update Rule group (permission needed: #zone:edit)
66
     * Update the state of a rule group
67
     *
68
     * @param string      $zone_identifier
69
     * @param string      $package_identifier
70
     * @param string      $identifier
71
     * @param string|null $mode               Whether or not the rules contained within this group are configurable/usable
72
     */
73
    public function update($zone_identifier, $package_identifier, $identifier, $mode = null)
74
    {
75
        $data = [
76
            'mode' => $mode,
77
        ];
78
79
        return $this->patch('/zones/'.$zone_identifier.'/firewall/waf/packages/'.$package_identifier.'/groups/'.$identifier, $data);
80
    }
81
}
82