url::url()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the Ariadne Component Library.
5
 *
6
 * (c) Muze <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace arc;
13
/**
14
 * Class url
15
 * Simple URL manipulation.
16
 * @package arc
17
 */
18
class url
19
{
20
    /**
21
     *	Returns a new URL object with easy access to the components (scheme, host, port, path, etc) and
22
     *	the query parameters in the url. It parses these according to PHP's own rules. If the URL is
23
     *	incompatible with PHP, use \arc\url\safeUrl() instead.
24
     *	@param string $url
25
     *	@return \arc\url\Url The parsed url object
26
    */
27 42
    public static function url($url)
28
    {
29 42
        return new url\Url( $url, new url\PHPQuery() );
30
    }
31
32
    /**
33
     * Returns a new URL object with easy access to the components (scheme, host, port, path, etc)
34
     * It will parse the query string without PHP centric assumptions. You can have the same parameter
35
     * present multiple times and it will automatically turn into an array. You can use parameters without
36
     * a value, these will become array values with a numbered index.
37
     * @param string $url
38
     * @return \arc\url\Url The url object
39
    */
40 16
    public static function safeUrl($url)
41
    {
42 16
        return new url\Url( $url, new url\Query() );
43
    }
44
}
45