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.

Registry   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 46
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A exists() 0 4 1
A bit() 0 4 1
A append() 0 12 2
1
<?php
2
3
namespace Saltwater\Water;
4
5
class Registry extends \ArrayObject
6
{
7
    /**
8
     * Return true if the input is a registered Salt
9
     *
10
     * @param string $name in the form "type.name"
11
     *
12
     * @return bool
13
     */
14
    public function exists($name)
15
    {
16
        return in_array($name, (array) $this);
17
    }
18
19
    /**
20
     * Return the bitmask integer of a Salt
21
     *
22
     * @param string $name in the form "type.name"
23
     *
24
     * @return bool|int
25
     */
26
    public function bit($name)
27
    {
28
        return array_search($name, (array) $this);
29
    }
30
31
    /**
32
     * Register a Salt and return its bitmask integer
33
     *
34
     * @param $name
35
     *
36
     * @return number
37
     */
38
    public function append($name)
39
    {
40
        if ($id = $this->bit($name)) {
41
            return $id;
42
        }
43
44
        $id = pow(2, count($this));
45
46
        $this[$id] = $name;
47
48
        return $id;
49
    }
50
}
51