functions.php ➔ uri()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of alchemy/resource-component.
5
 *
6
 * (c) Alchemy <[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
/**
13
 * @param string|\Alchemy\Resource\ResourceUri $uri A valid resource URI instance or string.
14
 * @return \Alchemy\Resource\ResourceUri
15
 */
16
function uri($uri) {
17 12
    if ($uri instanceof \Alchemy\Resource\ResourceUri) {
18 4
        return $uri;
19
    }
20
21 8
    return \Alchemy\Resource\ResourceUri::fromString($uri);
22
}
23