Completed
Pull Request — master (#152)
by ARCANEDEV
03:31 queued 02:21
created

helpers.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
use Arcanedev\Localization\Contracts\Localization;
6
7
if ( ! function_exists('localization')) {
8
    /**
9
     * Get the Localization instance.
10
     *
11
     * @return Arcanedev\Localization\Contracts\Localization
12
     */
13
    function localization(): Localization
14
    {
15
        return app(Localization::class);
16
    }
17
}
18
19
if ( ! function_exists('localized_route')) {
20
    /**
21
     * Get a localized URL with a given trans route name.
22
     *
23
     * @param  string       $transRoute
24
     * @param  array        $attributes
25
     * @param  string|null  $locale
26
     *
27
     * @return string
28
     */
29
    function localized_route($transRoute, array $attributes = [], $locale = null)
0 ignored issues
show
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...
30
    {
31
        if (is_null($locale))
32
            $locale = localization()->getCurrentLocale();
33
34
        return localization()->getUrlFromRouteName($locale, $transRoute, $attributes);
35
    }
36
}
37