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

GacelaProfiler::__construct()   A

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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 1
crap 1
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