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.

StatusCondition   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 8
c 3
b 0
f 0
lcom 0
cbo 3
dl 0
loc 40
ccs 0
cts 23
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C passesCondition() 0 29 8
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: shirshov
5
 * Date: 11.11.15
6
 * Time: 16:17
7
 */
8
9
namespace OldTown\Workflow\Util;
10
11
use OldTown\PropertySet\PropertySetInterface;
12
use OldTown\Workflow\ConditionInterface;
13
use OldTown\Workflow\Exception\WorkflowException;
14
use OldTown\Workflow\Spi\WorkflowEntryInterface;
15
use OldTown\Workflow\Spi\WorkflowStoreInterface;
16
use OldTown\Workflow\TransientVars\TransientVarsInterface;
17
18
/**
19
 * Simple utility condition that returns true if the current step's status is
20
 * the same as the required argument "status". Looks at ALL current steps unless
21
 * a stepId is given in the optional argument "stepId".
22
 *
23
 * @package OldTown\Workflow\Util
24
 */
25
class StatusCondition implements ConditionInterface
26
{
27
    /**
28
     * @param TransientVarsInterface $transientVars
29
     * @param array $args
30
     * @param PropertySetInterface $ps
31
     * @return bool
32
     *
33
     * @throws WorkflowException
34
     */
35
    public function passesCondition(TransientVarsInterface $transientVars, array $args = [], PropertySetInterface $ps)
36
    {
37
        $status = $args['status'];
38
        $stepId = array_key_exists('stepId', $args) ? (int)$args['stepId'] : 0;
39
40
        /** @var WorkflowEntryInterface $entry */
41
        $entry = $transientVars['entry'];
42
43
        /** @var WorkflowStoreInterface $store */
44
        $store = $transientVars['store'];
45
        $currentSteps = $store->findCurrentSteps($entry->getId());
46
47
        if ($stepId === 0) {
48
            foreach ($currentSteps as $step) {
49
                if ($status === $step->getStatus()) {
50
                    return true;
51
                }
52
            }
53
        } else {
54
            foreach ($currentSteps as $step) {
55
                if (($stepId === $step->getStepId())
56
                    && ($status === $step->getStatus())) {
57
                    return true;
58
                }
59
            }
60
        }
61
62
        return false;
63
    }
64
}
65