RequestServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 2
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
/**
10
 * Class RequestServiceProvider.
11
 */
12
class RequestServiceProvider extends ServiceProvider
13
{
14 48
    public function boot()
15
    {
16 48
        if (false === Request::hasMacro('isApiInternalCall')) {
17
            Request::macro('isApiInternalCall', function () {
18 8
                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

18
                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...
19 2
            });
20
        }
21 48
    }
22
}
23