Completed
Push — master ( aa413d...84f608 )
by Alejandro
21s queued 11s
created

UrlShortenerOptions   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 70%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 31
ccs 7
cts 10
cp 0.7
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isUrlValidationEnabled() 0 3 1
A setValidateUrl() 0 4 1
A setShortcodeChars() 0 4 2
A getChars() 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 UrlShortenerOptions extends AbstractOptions
9
{
10
    public const DEFAULT_CHARS = '123456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ';
11
12
    // phpcs:disable
13
    protected $__strictMode__ = false;
14
    // phpcs:enable
15
16
    private $shortcodeChars = self::DEFAULT_CHARS;
17
    private $validateUrl = true;
18
19 3
    public function getChars(): string
20
    {
21 3
        return $this->shortcodeChars;
22
    }
23
24
    protected function setShortcodeChars(string $shortcodeChars): self
25
    {
26
        $this->shortcodeChars = empty($shortcodeChars) ? self::DEFAULT_CHARS : $shortcodeChars;
27
        return $this;
28
    }
29
30 5
    public function isUrlValidationEnabled(): bool
31
    {
32 5
        return $this->validateUrl;
33
    }
34
35 7
    protected function setValidateUrl($validateUrl): self
36
    {
37 7
        $this->validateUrl = (bool) $validateUrl;
38 7
        return $this;
39
    }
40
}
41