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 — master ( aa4ff3...5266c0 )
by Alex
22:35
created

Registry   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 57
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A add() 0 8 2
A get() 0 8 2
A getIterator() 0 4 1
1
<?php
2
/**
3
 * This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * (c) fduch <[email protected]>
9
 *
10
 * Date: 31.08.16
11
 */
12
13
namespace Gtt\Bundle\WorkflowExtensionsBundle\Action;
14
15
use Gtt\Bundle\WorkflowExtensionsBundle\Action\Reference\ActionReferenceInterface;
16
use Gtt\Bundle\WorkflowExtensionsBundle\Exception\ActionException;
17
use IteratorAggregate;
18
use ArrayIterator;
19
20
/**
21
 * Workflow action registry
22
 *
23
 * @author fduch <[email protected]>
24
 */
25
class Registry implements IteratorAggregate
26
{
27
    /**
28
     * List of workflow actions
29
     *
30
     * @var ActionReferenceInterface[]
31
     */
32
    private $actions = [];
33
34
    /**
35
     * Registry constructor.
36
     *
37
     * @param array $actions list of action names associated to action references
38
     */
39
    public function __construct(array $actions = [])
40
    {
41
        foreach ($actions as $actionName => $actionReference) {
42
            $this->add($actionName, $actionReference);
43
        }
44
    }
45
46
    /**
47
     * Registers action by name in repository
48
     *
49
     * @param string                   $actionName action name
50
     * @param ActionReferenceInterface $action     action reference
51
     */
52
    public function add($actionName, ActionReferenceInterface $action)
53
    {
54
        if (array_key_exists($actionName, $this->actions)) {
55
            throw ActionException::actionAlreadyRegistered($actionName);
56
        }
57
        
58
        $this->actions[$actionName] = $action;
59
    }
60
61
    /**
62
     * Returns ActionInterface by name
63
     *
64
     * @param string $actionName action name
65
     *
66
     * @return ActionReferenceInterface
67
     */
68
    public function get($actionName)
69
    {
70
        if (!array_key_exists($actionName, $this->actions)) {
71
            throw ActionException::actionNotFound($actionName);
72
        }
73
74
        return $this->actions[$actionName];
75
    }
76
77
    public function getIterator()
78
    {
79
        return new ArrayIterator($this->actions);
80
    }
81
}
82