AppLicenseChecker::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Irfa\AppLicenseClient\Middleware;
4
5
use Closure;
6
use Irfa\AppLicenseClient\Facades\AppLicenseClient as AppLicense;
7
8
class AppLicenseChecker
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param  \Illuminate\Http\Request  $request
14
     * @param  \Closure  $next
15
     * @return mixed
16
     */
17
    public function handle($request, Closure $next)
18
    {
19
        if(AppLicense::check()){
20
            return $next($request);
21
        }
22
        $license = AppLicense::get();
23
        return abort(503,$license->message);
0 ignored issues
show
Bug introduced by
Are you sure the usage of abort(503, $license->message) 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...
24
25
    }
26
}
27