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.

Cap   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 14 4
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of PhuninNode.
6
 *
7
 ** (c) 2013 - 2016 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\PhuninNode\Commands;
14
15
use React\Promise\PromiseInterface;
16
use function React\Promise\resolve;
17
use WyriHaximus\PhuninNode\ConnectionContext;
18
19
class Cap implements CommandInterface
20
{
21
    use NodeAwareTrait;
22
23
    /**
24
     * @param ConnectionContext $context
25
     * @param string $line
26
     * @return PromiseInterface
27
     */
28 3
    public function handle(ConnectionContext $context, string $line): PromiseInterface
29
    {
30 3
        $caps = [];
31 3
        foreach ($this->getNode()->getPlugins() as $plugin) {
32 2
            foreach ($plugin->getCapabilities() as $capability) {
33 2
                if (in_array($capability, $caps)) {
34 1
                    continue;
35
                }
36
37 2
                $caps[] = $capability;
38
            }
39
        }
40 3
        return resolve($caps);
41
    }
42
}
43