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.

Organizer::reduce()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 8
nc 3
nop 1
dl 0
loc 12
ccs 9
cts 9
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace crojasaragonez\LightService;
6
7
class Organizer
8
{
9
    const SKIP_REMAINING = 'skip_remaining';
10
    const RESERVED_KEYS  = [self::SKIP_REMAINING];
11
12
    public $context;
13 21
    public function __construct(array $context = [])
14
    {
15 21
        $this->context = $context;
16 21
    }
17
18 21
    public function reduce($actions = []) : ?array
19
    {
20 21
        foreach ($actions as $action) {
21 18
            if ($this->context[self::SKIP_REMAINING] ?? false) {
22 6
                continue;
23
            }
24 15
            $instance = new $action($this->context);
25 15
            PreProcessor::validate($this, $instance);
26 9
            $instance->execute();
27 9
            PostProcessor::validate($this, $instance);
28
        }
29 12
        return ContextHelper::removeReservedKeys(Organizer::RESERVED_KEYS, $this->context);
30
    }
31
}
32