Completed
Push — 8.7 ( 735e8a...e29d62 )
by Markus
08:22 queued 05:11
created

FrontendUser::setProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DMK\MKSamlAuth\Model;
6
7
use DMK\MKSamlAuth\Exception\PropertyNotFoundException;
8
9
class FrontendUser
10
{
11
    protected $data;
12
13 5
    public function __construct(array $data)
14
    {
15 5
        $this->data = $data;
16 5
    }
17
18 2
    public function getUid()
19
    {
20 2
        return $this->data['uid'];
21
    }
22
23 5
    public function setProperty(string $name, string $value)
24
    {
25 5
        $this->data[$name] = $value;
26 5
    }
27
28 3
    public function hasProperty(string $name)
29
    {
30 3
        return isset($this->data[$name]);
31
    }
32
33 5
    public function getProperty(string $name)
34
    {
35 5
        if (false === \array_key_exists($name, $this->data)) {
36
            throw new PropertyNotFoundException(sprintf('The property "%s" does not exists!', $name));
37
        }
38
39 5
        return $this->data[$name];
40
    }
41
}
42