Passed
Pull Request — master (#252)
by Alejandro
03:08
created

NotFoundShortUrlOptions   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setEnableRedirection() 0 4 1
A setRedirectTo() 0 4 1
A getRedirectTo() 0 3 1
A isRedirectionEnabled() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Core\Options;
5
6
use Zend\Stdlib\AbstractOptions;
7
8
class NotFoundShortUrlOptions extends AbstractOptions
9
{
10
    /**
11
     * @var bool
12
     */
13
    private $enableRedirection = false;
14
    /**
15
     * @var string|null
16
     */
17
    private $redirectTo;
18
19
    public function isRedirectionEnabled(): bool
20
    {
21
        return $this->enableRedirection;
22
    }
23
24
    protected function setEnableRedirection(bool $enableRedirection = true): self
25
    {
26
        $this->enableRedirection = $enableRedirection;
27
        return $this;
28
    }
29
30
    public function getRedirectTo(): string
31
    {
32
        return $this->redirectTo ?? '';
33
    }
34
35
    protected function setRedirectTo(?string $redirectTo): self
36
    {
37
        $this->redirectTo = $redirectTo;
38
        return $this;
39
    }
40
}
41