BaseUri   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A toString() 0 3 1
A from() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace InShore\Bookwhen\ValueObjects\Transporter;
6
7
use InShore\Bookwhen\Contracts\StringableContract;
8
9
/**
10
 * @internal
11
 */
12
final class BaseUri implements StringableContract
13
{
14
    /**
15
     * Creates a new Base URI value object.
16
     */
17 21
    private function __construct(private readonly string $baseUri)
18
    {
19
        // ..
20 21
    }
21
22
    /**
23
     * Creates a new Base URI value object.
24
     */
25 22
    public static function from(string $baseUri): self
26
    {
27 22
        if (empty($baseUri)) {
28 1
            throw new \InvalidArgumentException();
29
        }
30 21
        return new self($baseUri);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 12
    public function toString(): string
37
    {
38 12
        return 'https://' . $this->baseUri . '/';
39
    }
40
}
41