Completed
Push — feature/controller ( 5a6415...9e7a26 )
by René
07:43 queued 05:40
created

Configuration::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 6
1
<?php
2
declare(strict_types = 1);
3
4
namespace Zortje\MVC\Configuration;
5
6
use Zortje\MVC\Configuration\Exception\ConfigurationNonexistentException;
7
8
/**
9
 * Class Configuration
10
 *
11
 * @package Zortje\MVC\Configuration
12
 */
13
class Configuration
14
{
15
16
    /**
17
     * @var array Internal configurations
18
     */
19
    protected $configurations = [];
20
21
    public function set(string $key, $value)
22
    {
23
        $this->configurations[$key] = $value;
24
    }
25
26
    public function get(string $key)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
27
    {
28
        if (isset($this->configurations[$key]) === false) {
29
            throw new ConfigurationNonexistentException([$key]);
30
        }
31
32
        return $this->configurations[$key];
33
    }
34
}
35