Completed
Push — master ( 0c7bb4...bd087f )
by ARCANEDEV
9s
created

helpers.php ➔ localized_route()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
if ( ! function_exists('localization')) {
4
    /**
5
     * Get the Localization instance.
6
     *
7
     * @return Arcanedev\Localization\Contracts\Localization
8
     */
9
    function localization()
10
    {
11
        return app(Arcanedev\Localization\Contracts\Localization::class);
12
    }
13
}
14
15
if ( ! function_exists('localized_route')) {
16
    /**
17
     * Get a localized URL with a given trans route name.
18
     *
19
     * @param  string       $transRoute
20
     * @param  array        $attributes
21
     * @param  string|null  $locale
22
     *
23
     * @return string
24
     */
25
    function localized_route($transRoute, array $attributes = [], $locale = null)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
26
    {
27
        if (is_null($locale))
28
            $locale = localization()->getCurrentLocale();
29
30
        return localization()->getUrlFromRouteName($locale, $transRoute, $attributes);
31
    }
32
}
33