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.

AbstractActionInspector::isStateAllowed()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Scheduler\ActionInspector;
4
5
use Scheduler\Action\ActionInterface;
6
7
/**
8
 * Class AbstractActionInspector
9
 *
10
 * @package Scheduler\ActionInspector
11
 * @author Aleh Hutnikau, <[email protected]>
12
 */
13
abstract class AbstractActionInspector implements ActionInspectorInterface
14
{
15
    protected $statesFlow = [
16
        ActionInterface::STATE_INITIAL => [ActionInterface::STATE_IN_PROGRESS, ActionInterface::STATE_FINISHED],
17
        ActionInterface::STATE_IN_PROGRESS => [ActionInterface::STATE_FINISHED],
18
        ActionInterface::STATE_FINISHED => [],
19
    ];
20
21
    /**
22
     * @param ActionInterface $action
23
     * @param $prevState
24
     * @return boolean
25
     */
26 3
    protected function isStateAllowed(ActionInterface $action, $prevState)
27
    {
28 3
        if ($prevState === null) {
29 3
            $result = true;
30 3
        } else {
31 3
            $result = in_array($action->getState(), $this->statesFlow[$prevState]);
32
        }
33 3
        return $result;
34
    }
35
}