Completed
Push — master ( 7c9eb0...a92430 )
by Thomas
13s
created

ThrowErrorsAsExceptionsOptions::getLevels()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Action\ThrowErrorsAsExceptions;
15
16
use Ekino\Drupal\Debug\Configuration\Model\DefaultsConfiguration;
17
use Ekino\Drupal\Debug\Option\OptionsInterface;
18
use Psr\Log\LoggerInterface;
19
20
class ThrowErrorsAsExceptionsOptions implements OptionsInterface
21
{
22
    /**
23
     * @var int
24
     */
25
    private $levels;
26
27
    /**
28
     * @var LoggerInterface|null
29
     */
30
    private $logger;
31
32
    /**
33
     * @param int                  $levels
34
     * @param LoggerInterface|null $logger
35
     */
36 10
    public function __construct(int $levels, ?LoggerInterface $logger)
37
    {
38 10
        $this->levels = $levels;
39 10
        $this->logger = $logger;
40 10
    }
41
42
    /**
43
     * @return int
44
     */
45 3
    public function getLevels(): int
46
    {
47 3
        return $this->levels;
48
    }
49
50
    /**
51
     * @return LoggerInterface|null
52
     */
53 4
    public function getLogger(): ?LoggerInterface
54
    {
55 4
        return $this->logger;
56
    }
57
58
    /**
59
     * @param string                $appRoot
60
     * @param DefaultsConfiguration $defaultsConfiguration
61
     *
62
     * @return ThrowErrorsAsExceptionsOptions
63
     */
64 3
    public static function getDefault(string $appRoot, DefaultsConfiguration $defaultsConfiguration): OptionsInterface
65
    {
66 3
        return new self(E_ALL, $defaultsConfiguration->getLogger());
67
    }
68
}
69