url()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
3
use Oddvalue\LinkBuilder\Contracts\Linkable;
4
5
if (! function_exists('get_link')) {
6
    /**
7
     * Convert a path to a URL.
8
     *
9
     * @param  string  $path
10
     * @return string
11
     */
12
    function get_link(Linkable $linkableModel, $options = [])
13
    {
14 3
        return $linkableModel->getLinkGenerator($options);
15
    }
16
}
17
18
if (! function_exists('url')) {
19
    /**
20
     * Convert a path to a URL.
21
     *
22
     * @param  string  $path
23
     * @return string
24
     */
25
    function url($path)
26
    {
27 3
        return '/'.ltrim($path, '/');
28
    }
29
}
30