| Conditions | 6 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 13 |
| Ratio | 59.09 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php namespace Mcamara\LaravelLocalization\Middleware; |
||
| 15 | public function handle( $request, Closure $next ) |
||
| 16 | { |
||
| 17 | $params = explode('/', $request->path()); |
||
| 18 | $locale = $request->cookie('locale', false); |
||
|
|
|||
| 19 | |||
| 20 | View Code Duplication | if ( count($params) > 0 && app('laravellocalization')->checkLocaleInSupportedLocales($params[ 0 ]) ) |
|
| 21 | { |
||
| 22 | cookie('locale', $params[ 0 ]); |
||
| 23 | |||
| 24 | return $next($request); |
||
| 25 | } |
||
| 26 | |||
| 27 | View Code Duplication | if ( $locale && !( app('laravellocalization')->getDefaultLocale() === $locale && app('laravellocalization')->hideDefaultLocaleInURL() ) ) |
|
| 28 | { |
||
| 29 | app('session')->reflash(); |
||
| 30 | $redirection = app('laravellocalization')->getLocalizedURL($locale); |
||
| 31 | |||
| 32 | return new RedirectResponse($redirection, 302, [ 'Vary' => 'Accept-Language' ]); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $next($request); |
||
| 36 | } |
||
| 37 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: