PluginRoutingKeyConfiguration::cfg()   A
last analyzed

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 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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