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
|
|
|
|