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 ( f9b38c...aac4f4 )
by Márk
10s
created

PlainMessage   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 95
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 14
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 95
ccs 28
cts 28
cp 1
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A all() 0 4 1
A get() 0 4 2
A has() 0 4 1
A offsetGet() 0 4 1
A offsetExists() 0 4 1
A offsetSet() 0 4 1
A offsetUnset() 0 4 1
A __get() 0 4 1
A __isset() 0 4 1
A __set() 0 4 1
A __unset() 0 4 1
1
<?php
2
3
namespace Bernard\Message;
4
5
use Bernard\Message;
6
7
/**
8
 * Simple message that gets you started.
9
 * It has a name and an array of arguments.
10
 * It does not enforce any types or properties so be careful on relying them
11
 * being there.
12
 */
13
final class PlainMessage implements Message, \ArrayAccess
14
{
15
    private $name;
16
    private $arguments;
17
18
    /**
19
     * @param string $name
20
     * @param array  $arguments
21
     */
22 50
    public function __construct($name, array $arguments = [])
23
    {
24 50
        $this->name = $name;
25 50
        $this->arguments = $arguments;
26 50
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 34
    public function getName()
32
    {
33 34
        return $this->name;
34
    }
35
36
    /**
37
     * @return array
38
     */
39 2
    public function all()
40
    {
41 2
        return $this->arguments;
42
    }
43
44
    /**
45
     * Returns the argument if found or null.
46
     *
47
     * @param string $name
48
     *
49
     * @return mixed
50
     */
51 2
    public function get($name)
52
    {
53 2
        return $this->has($name) ? $this->arguments[$name] : null;
54
    }
55
56
    /**
57
     * Checks whether the arguments contain the given key.
58
     *
59
     * @param string $name
60
     *
61
     * @return bool
62
     */
63 2
    public function has($name)
64
    {
65 2
        return array_key_exists($name, $this->arguments);
66
    }
67
68 1
    public function offsetGet($offset)
69
    {
70 1
        return $this->get($offset);
71
    }
72
73 1
    public function offsetExists($offset)
74
    {
75 1
        return $this->has($offset);
76
    }
77
78 1
    public function offsetSet($offset, $value)
79
    {
80 1
        throw new \LogicException('Message is immutable');
81
    }
82
83 1
    public function offsetUnset($offset)
84
    {
85 1
        throw new \LogicException('Message is immutable');
86
    }
87
88 1
    public function __get($property)
89
    {
90 1
        return $this->get($property);
91
    }
92
93 1
    public function __isset($property)
94
    {
95 1
        return $this->has($property);
96
    }
97
98 1
    public function __set($property, $value)
99
    {
100 1
        throw new \LogicException('Message is immutable');
101
    }
102
103 1
    public function __unset($property)
104
    {
105 1
        throw new \LogicException('Message is immutable');
106
    }
107
}
108