Passed
Push — feature/change-cache-to-profil... ( 160b60 )
by Chema
04:07
created

GacelaProfiler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 19
rs 10
ccs 6
cts 6
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A isEnabled() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\ClassResolver\Profiler;
6
7
use Gacela\Framework\Config\ConfigInterface;
8
9
final class GacelaProfiler
10
{
11
    public const KEY_ENABLED = 'gacela-profiler-enabled';
12
    public const DEFAULT_DIRECTORY_VALUE = '.gacela/profiler';
13
14
    private ConfigInterface $config;
15
16 38
    public function __construct(ConfigInterface $config)
17
    {
18 38
        $this->config = $config;
19
    }
20
21 38
    public function isEnabled(): bool
22
    {
23 38
        if ($this->config->hasKey(self::KEY_ENABLED)) {
24 8
            return (bool)$this->config->get(self::KEY_ENABLED);
25
        }
26
27 30
        return $this->config->getSetupGacela()->isProfilerEnabled();
28
    }
29
}
30