PluginRoutingKeyConfiguration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 1
A cfg() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
/*
4
 *  This file is part of the Micro framework package.
5
 *
6
 *  (c) Stanislau Komar <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace Micro\Framework\Kernel\Configuration;
13
14
class PluginRoutingKeyConfiguration extends PluginConfiguration
15
{
16 3
    public function __construct(
17
        ApplicationConfigurationInterface $configuration,
18
        protected readonly string $configRoutingKey
19
    ) {
20 3
        parent::__construct($configuration);
21
    }
22
23 3
    protected function cfg(string $key): string
24
    {
25 3
        return sprintf($key, mb_strtoupper($this->configRoutingKey));
26
    }
27
28
    /**
29
     * @param mixed $default
30
     */
31 3
    protected function get(string $key, mixed $default = null, bool $nullable = true): mixed
32
    {
33 3
        return $this->configuration->get(
34 3
            $this->cfg($key),
35 3
            $default,
36 3
            $nullable
37 3
        );
38
    }
39
}
40