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.
Completed
Push — dev ( 37e84b...c7bcbf )
by Андрей
06:51
created

Entry::completeEntry()   B

Complexity

Conditions 6
Paths 9

Size

Total Lines 20
Code Lines 13

Duplication

Lines 4
Ratio 20 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 20
ccs 0
cts 17
cp 0
rs 8.8571
cc 6
eloc 13
nc 9
nop 4
crap 42
1
<?php
2
/**
3
 * @link https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\Engine;
7
8
use OldTown\Workflow\Exception\InternalWorkflowException;
9
use OldTown\Workflow\Exception\InvalidArgumentException;
10
use OldTown\Workflow\Loader\ActionDescriptor;
11
use Traversable;
12
use DateTime;
13
14
/**
15
 * Class Entry
16
 *
17
 * @package OldTown\Workflow\Engine
18
 */
19
class Entry extends AbstractEngine implements EntryInterface
20
{
21
    /**
22
     * @param ActionDescriptor $action
23
     * @param                  $id
24
     * @param array|Traversable $currentSteps
25
     * @param                  $state
26
     *
27
     * @return void
28
     *
29
     * @throws InvalidArgumentException
30
     * @throws InternalWorkflowException
31
     */
32
    public function completeEntry(ActionDescriptor $action = null, $id, $currentSteps, $state)
33
    {
34 View Code Duplication
        if (!is_array($currentSteps) && !$currentSteps  instanceof Traversable) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
            $errMsg = 'Invalid currentSteps';
36
            throw new InvalidArgumentException($errMsg);
37
        }
38
39
        $workflowManager = $this->getWorkflowManager();
40
        $context = $workflowManager->getContext();
41
42
        $store = $workflowManager->getConfiguration()->getWorkflowStore();
43
        $store->setEntryState($id, $state);
44
45
        $oldStatus = null !== $action ? $action->getUnconditionalResult()->getOldStatus() : 'Finished';
46
        $actionIdValue = null !== $action ? $action->getId() : -1;
47
        foreach ($currentSteps as $step) {
48
            $store->markFinished($step, $actionIdValue, new DateTime(), $oldStatus, $context->getCaller());
49
            $store->moveToHistory($step);
50
        }
51
    }
52
}
53