Passed
Push — master ( d7d8c0...c26592 )
by Mads
03:35
created

RequestServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Napp\Core\Api\Requests\Provider;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Support\ServiceProvider;
7
use Napp\Core\Api\Auth\NappHttpHeaders;
8
9
class RequestServiceProvider extends ServiceProvider
10
{
11 6
    public function boot()
12
    {
13 6
        if (false === Request::hasMacro('isApiInternalCall')) {
14 4
            Request::macro('isApiInternalCall', function () {
15 4
                return $this->header(NappHttpHeaders::NAPP_API_CALL_TYPE) === 'internal';
0 ignored issues
show
Bug introduced by
The method header() does not exist on Napp\Core\Api\Requests\P...\RequestServiceProvider. ( Ignorable by Annotation )

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

15
                return $this->/** @scrutinizer ignore-call */ header(NappHttpHeaders::NAPP_API_CALL_TYPE) === 'internal';

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
16 2
            });
17
        }
18 6
    }
19
20 6
    public function register()
21
    {
22 6
    }
23
}
24