Issues (51)

src/Middleware/ApplyUrlLocaleToRootPage.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Fomvasss\UrlAliases\Middleware;
4
5
use Closure;
6
7
class ApplyUrlLocaleToRootPage
8
{
9
    protected $app;
10
11
    protected $config;
12
    /**
13
     * Handle an incoming request.
14
     *
15
     * @param  \Illuminate\Http\Request  $request
0 ignored issues
show
The type Illuminate\Http\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
     * @param  \Closure  $next
17
     * @return mixed
18
     */
19
    public function handle($request, Closure $next)
20
    {
21
        $this->app = app();
0 ignored issues
show
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
        $this->app = /** @scrutinizer ignore-call */ app();
Loading history...
22
        $this->config = $this->app['config'];
23
24
        $supportedLocales = $this->config->get('url-aliases-laravellocalization.supportedLocales');
25
26
        if (empty($request->segment(1)) || count($request->segments()) == 1 && in_array($request->segment(1), array_keys($supportedLocales))) {
27
            return $next($request);
28
        }
29
30
        abort(404);
0 ignored issues
show
The function abort was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        /** @scrutinizer ignore-call */ 
31
        abort(404);
Loading history...
31
    }
32
}
33