Conditions | 7 |
Paths | 18 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
32 | function app_url($path = '', $query = [], $identifier = '') |
||
33 | { |
||
34 | 1 | if (is_string($query)) { |
|
35 | 1 | list($query, $identifier) = [$identifier, $query]; |
|
36 | } |
||
37 | |||
38 | 1 | $url = config("apps.url.$identifier", config('app.url')); |
|
39 | |||
40 | 1 | if ($path = ltrim($path, '/')) { |
|
41 | 1 | $url .= (strpos($path, '?') === 0 ? '' : '/').$path; |
|
42 | } |
||
43 | |||
44 | 1 | if ($query && $query = http_build_query($query, '', '&', PHP_QUERY_RFC3986)) { |
|
45 | 1 | $url .= (strpos($url, '?') === false ? '?' : '&').$query; |
|
46 | } |
||
47 | |||
48 | 1 | return $url; |
|
49 | } |
||
50 | } |
||
51 |