Completed
Push — batch-iterator ( dd6368 )
by Davide
02:02
created

StreamUrl::fromBaseUrlAndName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
namespace EventStore\StreamFeed;
3
4
final class StreamUrl
5
{
6
    private $url;
7
8
    /**
9
     * @param string $baseUrl
10
     * @param string $name
11
     */
12 25
    public static function fromBaseUrlAndName($baseUrl, $name)
13
    {
14 25
        $baseUrl = rtrim($baseUrl, '/');
15 25
        return new self("$baseUrl/streams/$name");
16
    }
17
18 25
    private function __construct($url)
19
    {
20 25
        $this->url = $url;
21 25
    }
22
23 25
    public function __toString()
24
    {
25 25
        return $this->url;
26
    }
27
}
28