| Total Complexity | 9 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class UrlShortenerOptions extends AbstractOptions |
||
| 15 | { |
||
| 16 | protected $__strictMode__ = false; // phpcs:ignore |
||
| 17 | |||
| 18 | private bool $validateUrl = true; |
||
| 19 | private int $redirectStatusCode = DEFAULT_REDIRECT_STATUS_CODE; |
||
| 20 | private int $redirectCacheLifetime = DEFAULT_REDIRECT_CACHE_LIFETIME; |
||
| 21 | |||
| 22 | 4 | public function isUrlValidationEnabled(): bool |
|
| 25 | } |
||
| 26 | |||
| 27 | 6 | protected function setValidateUrl(bool $validateUrl): void |
|
| 30 | 6 | } |
|
| 31 | |||
| 32 | 14 | public function redirectStatusCode(): int |
|
| 33 | { |
||
| 34 | 14 | return $this->redirectStatusCode; |
|
| 35 | } |
||
| 36 | |||
| 37 | 7 | protected function setRedirectStatusCode(int $redirectStatusCode): void |
|
| 38 | { |
||
| 39 | 7 | $this->redirectStatusCode = $this->normalizeRedirectStatusCode($redirectStatusCode); |
|
| 40 | 7 | } |
|
| 41 | |||
| 42 | 7 | private function normalizeRedirectStatusCode(int $statusCode): int |
|
| 43 | { |
||
| 44 | 7 | return contains([301, 302], $statusCode) ? $statusCode : DEFAULT_REDIRECT_STATUS_CODE; |
|
| 45 | } |
||
| 46 | |||
| 47 | 3 | public function redirectCacheLifetime(): int |
|
| 50 | } |
||
| 51 | |||
| 52 | 7 | protected function setRedirectCacheLifetime(int $redirectCacheLifetime): void |
|
| 57 | 7 | } |
|
| 58 | } |
||
| 59 |