1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * @license MIT, http://opensource.org/licenses/MIT |
||||
5 | * @copyright Aimeos (aimeos.org), 2017-2023 |
||||
6 | */ |
||||
7 | |||||
8 | |||||
9 | if( !function_exists( 'airoute' ) ) |
||||
10 | { |
||||
11 | /** |
||||
12 | * Generate the URL to a named route. |
||||
13 | * |
||||
14 | * @param array|string $name |
||||
15 | * @param mixed $parameters |
||||
16 | * @param bool $absolute |
||||
17 | * @return string |
||||
18 | */ |
||||
19 | function airoute( $name, $parameters = [], $absolute = true ) |
||||
20 | { |
||||
21 | if( $current = Route::current() ) |
||||
22 | { |
||||
23 | $site = config( 'app.shop_multishop' ) ? config( 'shop.mshop.locale.site', 'default' ) : null; |
||||
0 ignored issues
–
show
'app.shop_multishop' of type string is incompatible with the type array expected by parameter $options of config() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
24 | |||||
25 | $parameters['site'] ??= $current->parameter( 'site', Request::get( 'site', $site ) ); |
||||
26 | $parameters['locale'] ??= $current->parameter( 'locale', Request::get( 'locale' ) ); |
||||
27 | $parameters['currency'] ??= $current->parameter( 'currency', Request::get( 'currency' ) ); |
||||
28 | } |
||||
29 | |||||
30 | return app( 'url' )->route( $name, array_filter( $parameters ), $absolute ); |
||||
0 ignored issues
–
show
It seems like
$name can also be of type array ; however, parameter $name of Illuminate\Routing\UrlGenerator::route() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
31 | } |
||||
32 | } |
||||
33 | |||||
34 | |||||
35 | if( !function_exists( 'aiconfig' ) ) |
||||
36 | { |
||||
37 | /** |
||||
38 | * Returns the configuration setting for the given key |
||||
39 | * |
||||
40 | * @param string $key Configuration key |
||||
41 | * @param mixed $default Default value if the configuration key isn't found |
||||
42 | * @return mixed Configuration value |
||||
43 | */ |
||||
44 | function aiconfig( $key, $default = null ) |
||||
45 | { |
||||
46 | return app( 'aimeos.config' )->get()->get( $key, $default ); |
||||
0 ignored issues
–
show
The call to
Illuminate\Container\Container::get() has too few arguments starting with id .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
47 | } |
||||
48 | } |
||||
49 | |||||
50 | |||||
51 | if( !function_exists( 'aitrans' ) ) |
||||
52 | { |
||||
53 | /** |
||||
54 | * Translates the given message |
||||
55 | * |
||||
56 | * @param string $singular Message to translate |
||||
57 | * @param array $params List of paramters for replacing the placeholders in that order |
||||
58 | * @param string $domain Translation domain |
||||
59 | * @param string $locale ISO language code, maybe combine with ISO currency code, e.g. "en_US" |
||||
60 | * @return string Translated string |
||||
61 | */ |
||||
62 | function aitrans( $singular, array $params = array(), $domain = 'client', $locale = null ) |
||||
63 | { |
||||
64 | $i18n = app( 'aimeos.context' )->get()->i18n( $locale ); |
||||
0 ignored issues
–
show
The call to
Illuminate\Container\Container::get() has too few arguments starting with id .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
65 | |||||
66 | return vsprintf( $i18n->dt( $domain, $singular ), $params ); |
||||
67 | } |
||||
68 | } |
||||
69 | |||||
70 | |||||
71 | if( !function_exists( 'aitransplural' ) ) |
||||
72 | { |
||||
73 | /** |
||||
74 | * Translates the given messages based on the number |
||||
75 | * |
||||
76 | * @param string $singular Message to translate |
||||
77 | * @param string $plural Message for plural translations |
||||
78 | * @param integer $number Count of items to chose the correct plural translation |
||||
79 | * @param array $params List of paramters for replacing the placeholders in that order |
||||
80 | * @param string $domain Translation domain |
||||
81 | * @param string $locale ISO language code, maybe combine with ISO currency code, e.g. "en_US" |
||||
82 | * @return string Translated string |
||||
83 | */ |
||||
84 | function aitransplural( $singular, $plural, $number, array $params = array(), $domain = 'client', $locale = null ) |
||||
85 | { |
||||
86 | $i18n = app( 'aimeos.context' )->get()->i18n( $locale ); |
||||
0 ignored issues
–
show
The call to
Illuminate\Container\Container::get() has too few arguments starting with id .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
87 | |||||
88 | return vsprintf( $i18n->dn( $domain, $singular, $plural, $number ), $params ); |
||||
89 | } |
||||
90 | } |
||||
91 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.