Issues (652)

app/Http/Middleware/CheckSettingsPanel.php (2 issues)

1
<?php
2
3
namespace Uccello\Core\Http\Middleware;
4
5
use Closure;
6
use Auth;
7
8
class CheckSettingsPanel
9
{
10
    /**
11
     * Check if the user can access to the settings panel or redirect to 403 page.
12
     *
13
     * @param  \Illuminate\Http\Request  $request
14
     * @param  \Closure  $next
15
     * @return mixed
16
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
17
     */
18
    public function handle($request, Closure $next)
19
    {
20
        $user = Auth::user();
21
22
        $domain = $request->domain;
23
24
        if (!$user->canAccessToSettingsPanel($domain)) {
0 ignored issues
show
The method canAccessToSettingsPanel() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

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

24
        if (!$user->/** @scrutinizer ignore-call */ canAccessToSettingsPanel($domain)) {
Loading history...
25
            return abort(403);
0 ignored issues
show
Are you sure the usage of abort(403) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
26
        }
27
28
        return $next($request);
29
    }
30
}
31