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.

ModuleList   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 49
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A filterByBit() 0 11 3
A filterOneBit() 0 10 3
1
<?php
2
3
namespace Saltwater\Water;
4
5
use Saltwater\Salt\Module;
6
7
class ModuleList
8
{
9
    /**
10
     * @var Module[]
11
     */
12
    private $list = array();
13
14
    public function __construct($list)
15
    {
16
        $this->list = $list;
17
    }
18
19
    /**
20
     * Return a list of Modules providing a Salt
21
     *
22
     * @param int $bit
23
     *
24
     * @return Module[]|string[]
25
     */
26
    public function filterByBit($bit)
27
    {
28
        $return = array();
29
        foreach ($this->list as $module) {
30
            if ($module->has($bit)) {
31
                $return[] = $module::getName();
32
            }
33
        }
34
35
        return $return;
36
    }
37
38
    /**
39
     * Return one Module providing a Salt
40
     *
41
     * @param int $bit
42
     *
43
     * @return Module|string
44
     */
45
    public function filterOneBit($bit)
46
    {
47
        foreach ($this->list as $module) {
48
            if ($module->has($bit)) {
49
                return $module::getName();
50
            }
51
        }
52
53
        return false;
54
    }
55
}
56