Completed
Pull Request — master (#3)
by Бабичев
02:07
created

Build::url()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Bavix\Router;
4
5
class Build
6
{
7
8
    /**
9
     * @param string $path
10
     * @param null|string $host
11
     * @param null|string $protocol
12
     * @return string
13
     */
14 4
    public static function url(string $path, ?string $host = null, ?string $protocol = null): string
15
    {
16 4
        $scheme = $protocol ?? Server::sharedInstance()->protocol();
17 4
        $host = $host ?? Server::sharedInstance()->host();
18 4
        return $scheme . '://' . $host . $path;
19
    }
20
21
}
22