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

Build   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A url() 0 5 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