Test Failed
Pull Request — master (#3)
by Бабичев
02:15
created

Build::url()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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