TracingRequestGuard   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A allowRequest() 0 15 5
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