Conditions | 8 |
Paths | 7 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
37 | 104 | public function getValue() |
|
38 | { |
||
39 | 104 | if (null === $this->value || !is_string($this->value)) { |
|
40 | 18 | return null; |
|
41 | } |
||
42 | |||
43 | 90 | if ($this->isExternal() && false !== Url::normalizeUrl($this->value)) { |
|
44 | 8 | $value = $this->value; |
|
45 | } else { |
||
46 | 86 | $domain = $this->getDomain() ?? ''; |
|
47 | 86 | $value = str_replace($domain, '', $this->value); |
|
48 | |||
49 | 86 | if ('' !== $value) { |
|
50 | 86 | $value = $domain . '/' . ltrim($value, '/'); |
|
51 | } |
||
52 | } |
||
53 | |||
54 | 90 | $attributes = $this->getAttributes(); |
|
55 | |||
56 | 90 | if ('' !== $value && [] !== $attributes) { |
|
57 | 14 | return [$value => $attributes]; |
|
58 | } |
||
59 | |||
60 | 82 | return $value; |
|
61 | } |
||
73 |