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.

ConfigValueCondition   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 51
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A match() 0 10 2
1
<?php
2
3
/**
4
 * Workflow library.
5
 *
6
 * @package    workflow
7
 * @author     David Molineus <[email protected]>
8
 * @copyright  2014-2017 netzmacht David Molineus
9
 * @license    LGPL 3.0 https://github.com/netzmacht/workflow
10
 * @filesource
11
 */
12
13
declare(strict_types=1);
14
15
namespace Netzmacht\Workflow\Flow\Condition\Workflow;
16
17
use Netzmacht\Workflow\Data\EntityId;
18
use Netzmacht\Workflow\Flow\Workflow;
19
20
/**
21
 * This condition checks a config parameter value
22
 *
23
 * @package Netzmacht\Contao\Workflow\Condition\Workflow
24
 */
25
class ConfigValueCondition implements Condition
26
{
27
    /**
28
     * Name of the config parameter.
29
     *
30
     * @var string
31
     */
32
    private $name;
33
34
    /**
35
     * Value of the config parameter.
36
     *
37
     * @var mixed
38
     */
39
    private $value;
40
41
    /**
42
     * If true a strict comparison is made.
43
     *
44
     * @var bool
45
     */
46
    private $strict;
47
48
    /**
49
     * ConfigCondition constructor.
50
     *
51
     * @param string $name   Name of the config parameter.
52
     * @param mixed  $value  Value of the config parameter.
53
     * @param bool   $strict If true a strict comparison is made.
54
     */
55
    public function __construct(string $name, $value, bool $strict = false)
56
    {
57
        $this->name   = $name;
58
        $this->value  = $value;
59
        $this->strict = $strict;
60
    }
61
62
    /**
63
     * {@inheritDoc}
64
     */
65
    public function match(Workflow $workflow, EntityId $entityId, $entity): bool
66
    {
67
        $value = $workflow->getConfigValue($this->name);
68
69
        if ($this->strict) {
70
            return $this->value === $value;
71
        }
72
73
        return $this->value == $value;
74
    }
75
}
76