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 ( c67920...7102a7 )
by Samuel
02:36
created

Registry::setRegistryValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php declare (strict_types=1);
2
3
/**
4
 * This file is part of the Samshal\Acl library
5
 *
6
 * @license MIT
7
 * @copyright Copyright (c) 2016 Samshal http://samshal.github.com
8
 */
9
namespace Samshal\Acl\Registry;
10
11
/**
12
 * Class Registry
13
 *
14
 * @package samshal.acl.registry
15
 * @author Samuel Adeshina <[email protected]>
16
 * @since 31/05/2016
17
 */
18
class Registry implements RegistryInterface
19
{
20
    /**
21
     * @var array $registry
22
     */
23
    protected $registry = [];
24
25
    /**
26
     * Saves an object to the registry
27
     *
28
     * @param string $object
29
     * @param variadic $options
30
     * @return void
31
     */
32
    public function save(string $object, ...$options)
33
    {
34
        if (!$this->exists($object)) {
35
            $this->registry[$object] = [];
36
        }
37
38
        return;
39
    }
40
41
    /**
42
     * removes an object from the registry
43
     *
44
     * @param string $object
45
     * @return void
46
     */
47
    public function remove(string $object) : bool
48
    {
49
        if ($this->exists($object)) {
50
            unset($this->registry[$object]);
51
        }
52
53
        return;
54
    }
55
56
    /**
57
     * determines if an object exists in the registry
58
     *
59
     * @param string $object
60
     * @return boolean
61
     */
62
    public function exists(string $object) : bool
63
    {
64
        return (!empty($this->registry) && isset($this->registry[$object]));
65
    }
66
67
    /**
68
     * retrieves an object index from the registry
69
     *
70
     * @param string $object
71
     * @return mixed
72
     */
73
    public function get(string $object)
74
    {
75
        return ($this->exists($object)) ? $this->registry[$object] : null;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function getRegistry() : array
82
    {
83
        return $this->registry;
84
    }
85
86
    /**
87
     * returns the names of objects stored in the registry
88
     *
89
     * @return array
90
     */
91
    public function getRegistryNames() : array
92
    {
93
        $names = [];
94
        foreach ($this->getRegistry() as $registryName=>$registryValue)
95
        {
96
            $names[] = $registryName;
97
        }
98
99
        return $names;
100
    }
101
102
    /**
103
     * Sets the value of a registry object
104
     *
105
     * @param string $registryIndex
106
     * @param string $registryValue
107
     * @return void
108
     */
109
    public function setRegistryValue(string $registryIndex, string $registryValue)
110
    {
111
        $this->registry[$registryIndex][] = $registryValue;
112
    }
113
}
114