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

Configuration   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 22
ccs 0
cts 7
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A get() 0 8 2
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