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.

Organizations   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 51
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A organizations() 0 14 1
A details() 0 4 1
A leave() 0 4 1
1
<?php
2
3
namespace Cloudflare\User;
4
5
use Cloudflare\Api;
6
7
/**
8
 * CloudFlare API wrapper
9
 *
10
 * Organizations
11
 *
12
 * @author James Bell <[email protected]>
13
 *
14
 * @version 1
15
 */
16
class Organizations extends Api
17
{
18
    /**
19
     * List organizations (permission needed: #organizations:read)
20
     * List organizations the user is associated with
21
     *
22
     * @param string|null $status    Whether or not the user is a member of the organization or has an inivitation pending
23
     * @param string|null $name      Organization Name
24
     * @param int|null    $page      Page number of paginated results
25
     * @param int|null    $per_page  Number of organizations per page
26
     * @param string|null $order     Field to order organizations by
27
     * @param string|null $direction Direction to order organizations
28
     * @param string|null $match     Whether to match all search requirements or at least one (any)
29
     */
30
    public function organizations($status = null, $name = null, $page = null, $per_page = null, $order = null, $direction = null, $match = 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...
31
    {
32
        $data = [
33
            'status'    => $status,
34
            'name'      => $name,
35
            'page'      => $page,
36
            'per_page'  => $per_page,
37
            'order'     => $order,
38
            'direction' => $direction,
39
            'match'     => $match,
40
        ];
41
42
        return $this->get('/user/organizations', $data);
43
    }
44
45
    /**
46
     * Organization details (permission needed: #organizations:read)
47
     * Get a specific organization the user is associated with
48
     *
49
     * @param string $identifier
50
     */
51
    public function details($identifier)
52
    {
53
        return $this->get('/user/organizations/'.$identifier);
54
    }
55
56
    /**
57
     * Leave organization (permission needed: #organizations:edit)
58
     * Remove association to an organization
59
     *
60
     * @param string $identifier
61
     */
62
    public function leave($identifier)
63
    {
64
        return $this->delete('/user/organizations/'.$identifier);
65
    }
66
}
67