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

Build   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

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
    public static function url(string $path, ?string $host = null, ?string $protocol = null): string
15
    {
16
        $scheme = $protocol ?? Server::sharedInstance()->protocol();
17
        $host = $host ?? Server::sharedInstance()->host();
18
        return $scheme . '://' . $host . $path;
19
    }
20
21
}
22