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

DisplayPrettyExceptionsOptions::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
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\DisplayPrettyExceptions;
15
16
use Ekino\Drupal\Debug\Configuration\Model\DefaultsConfiguration;
17
use Ekino\Drupal\Debug\Option\OptionsInterface;
18
use Psr\Log\LoggerInterface;
19
20
class DisplayPrettyExceptionsOptions implements OptionsInterface
21
{
22
    /**
23
     * @var string|null
24
     */
25
    private $charset;
26
27
    /**
28
     * @var string|null
29
     */
30
    private $fileLinkFormat;
31
32
    /**
33
     * @var LoggerInterface|null
34
     */
35
    private $logger;
36
37
    /**
38
     * @param string|null          $charset
39
     * @param string|null          $fileLinkFormat
40
     * @param LoggerInterface|null $logger
41
     */
42 11
    public function __construct(?string $charset, ?string $fileLinkFormat, ?LoggerInterface $logger)
43
    {
44 11
        $this->charset = $charset;
45 11
        $this->fileLinkFormat = $fileLinkFormat;
46 11
        $this->logger = $logger;
47 11
    }
48
49
    /**
50
     * @return string|null
51
     */
52 2
    public function getCharset(): ?string
53
    {
54 2
        return $this->charset;
55
    }
56
57
    /**
58
     * @return string|null
59
     */
60 2
    public function getFileLinkFormat(): ?string
61
    {
62 2
        return $this->fileLinkFormat;
63
    }
64
65
    /**
66
     * @return LoggerInterface|null
67
     */
68 2
    public function getLogger(): ?LoggerInterface
69
    {
70 2
        return $this->logger;
71
    }
72
73
    /**
74
     * @param string                $appRoot
75
     * @param DefaultsConfiguration $defaultsConfiguration
76
     *
77
     * @return DisplayPrettyExceptionsOptions
78
     */
79 3
    public static function getDefault(string $appRoot, DefaultsConfiguration $defaultsConfiguration): OptionsInterface
80
    {
81 3
        return new self($defaultsConfiguration->getCharset(), $defaultsConfiguration->getFileLinkFormat(), $defaultsConfiguration->getLogger());
82
    }
83
}
84