Passed
Pull Request — master (#296)
by Alejandro
04:52
created

UrlShortenerOptions::isUrlValidationEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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