Passed
Pull Request — develop (#83)
by
unknown
12:02
created

BaseUri   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A toString() 0 3 1
A from() 0 3 1
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
    private function __construct(private readonly string $baseUri)
18
    {
19
        // ..
20
    }
21
22
    /**
23
     * Creates a new Base URI value object.
24
     */
25
    public static function from(string $baseUri): self
26
    {
27
        return new self($baseUri);
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function toString(): string
34
    {
35
        return 'https://' . $this->baseUri . '/';
36
    }
37
}
38