These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Thinktomorrow\Locale\LocaleUrl; |
||
4 | |||
5 | 1 | if (!function_exists('localeurl')) { |
|
6 | /** |
||
7 | * @param $url |
||
8 | * @param null $locale |
||
9 | * @param array $extra |
||
10 | * @param null $secure |
||
11 | * |
||
12 | * @return mixed |
||
13 | */ |
||
14 | function localeurl($url, $locale = null, $extra = [], $secure = null) |
||
15 | { |
||
16 | 3 | return app(LocaleUrl::class)->to($url, $locale, $extra, $secure); |
|
17 | } |
||
18 | } |
||
19 | |||
20 | 1 | if (!function_exists('localeroute')) { |
|
21 | /** |
||
22 | * @param $name |
||
23 | * @param null $locale |
||
24 | * @param array $parameters |
||
25 | * @param bool $asCanonical |
||
26 | * |
||
27 | * @return |
||
28 | */ |
||
29 | function localeroute($name, $locale = null, $parameters = [], $asCanonical = true) |
||
30 | { |
||
31 | 4 | return app(LocaleUrl::class)->route($name, $locale, $parameters, $asCanonical); |
|
32 | } |
||
33 | } |
||
34 | |||
35 | /* |
||
36 | * Detect locale and return the active segment. Usefull for route segment injections |
||
37 | */ |
||
38 | 1 | if (!function_exists('localeRoutePrefix')) { |
|
39 | function localeRoutePrefix() |
||
0 ignored issues
–
show
|
|||
40 | { |
||
41 | 1 | return app(\Thinktomorrow\Locale\Detect::class) |
|
42 | 1 | ->detectLocale() |
|
43 | 1 | ->getScope() |
|
44 | 1 | ->activeSegment(); |
|
45 | } |
||
46 | } |
||
47 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.