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.

ArrayWorkflowFactory::initDone()   A
last analyzed

Complexity

Conditions 4
Paths 5

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 12
cp 0
rs 9.2
cc 4
eloc 9
nc 5
nop 0
crap 20
1
<?php
2
/**
3
 * @link    https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\Loader;
7
8
use OldTown\Workflow\Exception\FactoryException;
9
use OldTown\Workflow\Exception\InvalidParsingWorkflowException;
10
use OldTown\Workflow\Loader\XMLWorkflowFactory\WorkflowConfig;
11
12
13
/**
14
 * Class ArrayWorkflowFactory
15
 *
16
 * @package OldTown\Workflow\Loader
17
 */
18
class  ArrayWorkflowFactory extends XmlWorkflowFactory
19
{
20
    /**
21
     *
22
     * @var string
23
     */
24
    const WORKFLOWS_PROPERTY = 'workflows';
25
26
    /**
27
     *
28
     * @return void
29
     * @throws FactoryException
30
     * @throws InvalidParsingWorkflowException
31
     * @throws \OldTown\Workflow\Exception\RemoteException
32
     */
33
    public function initDone()
34
    {
35
        $this->reload = true === $this->getProperties()->getProperty(static::RELOAD_PROPERTY, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a null|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
36
        $workflows = $this->getProperties()->getProperty(static::WORKFLOWS_PROPERTY, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a null|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
37
38
        $basedir = null;
39
        foreach ($workflows as $name => $workflowItem) {
40
            $type = array_key_exists('type', $workflowItem) ?  $workflowItem['type'] : WorkflowConfig::FILE_TYPE;
41
            $location = array_key_exists('location', $workflowItem) ?  $workflowItem['location'] : '';
42
            $config = $this->buildWorkflowConfig($basedir, $type, $location);
43
            $this->workflows[$name] = $config;
44
        }
45
    }
46
}
47