TracingRequestGuard::allowRequest()   A
last analyzed

Complexity

Conditions 5
Paths 7

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
rs 9.6111
cc 5
nc 7
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\Jaravel\Services\Http;
6
7
use Illuminate\Http\Request;
8
use Illuminate\Support\Facades\Config;
9
use Umbrellio\Jaravel\Services\Caller;
10
11
class TracingRequestGuard
12
{
13
    public function allowRequest(Request $request): bool
14
    {
15
        if (Config::get('jaravel.http.allow_request')) {
16
            if (!Caller::call(Config::get('jaravel.http.allow_request'), [$request])) {
17
                return false;
18
            }
19
        }
20
21
        if (Config::get('jaravel.http.deny_request')) {
22
            if (Caller::call(Config::get('jaravel.http.deny_request'), [$request])) {
23
                return false;
24
            }
25
        }
26
27
        return true;
28
    }
29
}
30