Lines
100.00%
5 / 5
Methods
100.00%
3 / 3
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getDefaultUrl | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| getAllowedMediaHosts | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| 24 | readonly class UrlSettings | |
| 25 | { | |
| 26 | public function __construct( | |
| 27 | private CoreConfiguration $coreConfiguration, | |
| 28 | ) { | |
| 29 | } | |
| 30 | ||
| 31 | public function getDefaultUrl(): string | |
| 32 | { | |
| 33 | $defaultUrl = (string) $this->coreConfiguration->get(item: 'main.referenceURL'); | |
| 34 | return str_ends_with($defaultUrl, '/') ? $defaultUrl : $defaultUrl . '/'; | |
| 35 | } | |
| 36 | ||
| 37 | /** | |
| 38 | * Returns an array with allowed media hosts for records. | |
| 39 | * @return string[] | |
| 40 | */ | |
| 41 | public function getAllowedMediaHosts(): array | |
| 42 | { | |
| 43 | $val = (string) $this->coreConfiguration->get(item: 'records.allowedMediaHosts'); | |
| 44 | return $val === '' ? [] : explode(',', $val); | |
| 45 | } | |
| 46 | } |