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.

JoinNodes::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12
Metric Value
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.4285
cc 3
eloc 7
nc 3
nop 1
crap 12
1
<?php
2
/**
3
 * @link    https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow;
7
8
use OldTown\Workflow\Exception\InternalWorkflowException;
9
use \OldTown\Workflow\JoinNodes\DummyStep;
10
use OldTown\Workflow\Spi\StepInterface;
11
12
/**
13
 * Class JoinNodes
14
 *
15
 * @package OldTown\Workflow
16
 */
17
class JoinNodes
18
{
19
    /**
20
     * @var StepInterface[]
21
     */
22
    protected $steps;
23
24
    /**
25
     * @var DummyStep
26
     */
27
    protected $dummy;
28
29
    /**
30
     * @param array $steps
31
     *
32
     * @throws \OldTown\Workflow\Exception\InternalWorkflowException
33
     */
34
    public function __construct(array $steps = [])
35
    {
36
        foreach ($steps as $step) {
37
            if (!$step instanceof StepInterface) {
38
                $errMsg = 'Некорректная коллекция из шагов workflow';
39
                throw new InternalWorkflowException($errMsg);
40
            }
41
        }
42
43
        $this->dummy = new DummyStep();
44
        $this->steps = $steps;
45
    }
46
47
    /**
48
     * @param $stepId
49
     *
50
     * @return DummyStep|StepInterface
51
     */
52
    public function getStep($stepId)
53
    {
54
        foreach ($this->steps as $step) {
55
            if ($step->getId() === $stepId) {
56
                return $step;
57
            }
58
        }
59
60
        return $this->dummy;
61
    }
62
}
63