KeyStore   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setKeys() 0 3 1
A getKey() 0 5 1
1
<?php
2
3
namespace Lefty\KeyStore;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
// use Anax\Route\Exception\ForbiddenException;
9
// use Anax\Route\Exception\NotFoundException;
10
// use Anax\Route\Exception\InternalErrorException;
11
12
/**
13
 * A sample controller to show how a controller class can be implemented.
14
 * The controller will be injected with $di if implementing the interface
15
 * ContainerInjectableInterface, like this sample class does.
16
 * The controller is mounted on a particular route and can then handle all
17
 * requests for that mount point.
18
 *
19
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
20
 */
21
22
23
class KeyStore implements ContainerInjectableInterface
24
{
25
    use ContainerInjectableTrait;
26
27
    private $keys = [];
28
29 6
    public function setKeys($keys)
30
    {
31 6
        $this->keys = $keys;
32 6
    }
33
34 6
    public function getKey($key)
35
    {
36
        // var_dump($this->keys);
37
        // var_dump($key);
38 6
        return $this->keys[$key] ?? "default key is missing";
39
    }
40
}
41