Conditions | 6 |
Paths | 12 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
37 | function app_url($path = '', $query = [], $identifier = '') |
||
38 | { |
||
39 | 1 | if (is_string($query)) { |
|
40 | 1 | list($query, $identifier) = [$identifier, $query]; |
|
41 | } |
||
42 | |||
43 | 1 | if ($path = ltrim($path, '/')) { |
|
44 | 1 | $path = '/'.$path; |
|
45 | } |
||
46 | |||
47 | 1 | if ($query && $query = http_build_query($query)) { |
|
48 | 1 | $path .= (str_contains($path, ['?', '&', '#']) ? '&' : '?').$query; |
|
49 | } |
||
50 | |||
51 | 1 | return config("apps.url.$identifier", config('app.url')).$path; |
|
52 | } |
||
54 |