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.
Passed
Push — develop ( 8960eb...4cfcae )
by Toby
12:56
created

ObserverStore::attach()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Observers\NotifyObservers\Framework;
4
5
class ObserverStore
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ObserverStore
Loading history...
6
{
7
8
    private $observers = [];
0 ignored issues
show
Coding Style introduced by
Private member variable "observers" must be prefixed with an underscore
Loading history...
9
    
10 796
    public function attach($notifier, $observer): void
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function attach()
Loading history...
11
    {
12 796
        if(!array_key_exists($notifier, $this->observers)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
13 796
            $this->observers[$notifier] = [];
14
        }
15 796
        $this->observers[$notifier][] = $observer;
16 796
    }
17
18 1
    public function detach($notifier, $observer): void
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function detach()
Loading history...
19
    {
20 1
        if (array_key_exists($notifier, $this->observers)) {
21 1
            if (($key = array_search($observer, $this->observers[$notifier])) !== false) {
22 1
                unset($this->observers[$notifier][$key]);
23 1
                $this->observers[$notifier] = array_values($this->observers[$notifier]);
24
            }
25
        }
26 1
    }
27
    
28 154
    public function forNotifier($notifier): array
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function forNotifier()
Loading history...
29
    {
30 154
        if(array_key_exists($notifier, $this->observers)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
31 154
            return $this->observers[$notifier];
32
        }
33
        return [];
34
    }
35
}