Completed
Pull Request — master (#5)
by
unknown
03:37
created

UrlNormalizer::testUrlProtocol()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php namespace Lbc\Helper;
2
3
class UrlNormalizer
4
{
5
    /**
6
     * Test if the url contains a protocol (add http if not)
7
     *
8
     * @param string $url
9
     *
10
     * @return string
11
     */
12
    public static function testUrlProtocol($url)
13
    {
14
        if (substr($url, 0, 4) != "http") {
15
            $url = "http:" . $url;
16
        }
17
18
        return $url;
19
    }
20
}
21