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.

Properties   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 72
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toArray() 0 4 1
A has() 0 4 1
A set() 0 6 1
A get() 0 8 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\Context;
16
17
/**
18
 * Class Properties
19
 */
20
class Properties
21
{
22
    /**
23
     * Properties.
24
     *
25
     * @var array
26
     */
27
    private $properties = [];
28
29
    /**
30
     * Properties constructor.
31
     *
32
     * @param array $properties Properties.
33
     */
34
    public function __construct(array $properties = [])
35
    {
36
        $this->properties = $properties;
37
    }
38
39
    /**
40
     * Get properties.
41
     *
42
     * @return array
43
     */
44
    public function toArray(): array
45
    {
46
        return $this->properties;
47
    }
48
49
    /**
50
     * Check if a property exists.
51
     *
52
     * @param string $propertyName Name of the property.
53
     *
54
     * @return bool
55
     */
56
    public function has(string $propertyName): bool
57
    {
58
        return array_key_exists($propertyName, $this->properties);
59
    }
60
61
    /**
62
     * Set a property value.
63
     *
64
     * @param string $propertyName Name of the property.
65
     * @param mixed  $value        Value of the property.
66
     *
67
     * @return Properties
68
     */
69
    public function set(string $propertyName, $value): self
70
    {
71
        $this->properties[$propertyName] = $value;
72
73
        return $this;
74
    }
75
76
    /**
77
     * Get the property value. If property does not exist, null is returned.
78
     *
79
     * @param string $propertyName Name of the property.
80
     *
81
     * @return mixed
82
     */
83
    public function get(string $propertyName)
84
    {
85
        if (isset($this->properties[$propertyName])) {
86
            return $this->properties[$propertyName];
87
        }
88
89
        return null;
90
    }
91
}
92