BasicAuthenticator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authenticateRequest() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace Trucker\Requests\Auth;
4
5
use Guzzle\Http\Message\Request;
6
use Illuminate\Container\Container;
7
use Trucker\Facades\Config;
8
9
class BasicAuthenticator implements AuthenticationInterface
10
{
11
    /**
12
     * The IoC Container.
13
     *
14
     * @var Container
15
     */
16
    protected $app;
17
18
    /**
19
     * Constructor, likely never called in implementation
20
     * but rather through the Factory.
21
     *
22
     * @param Container $app
23
     */
24 2
    public function __construct(Container $app)
25
    {
26 2
        $this->app = $app;
27 2
    }
28
29
    /**
30
     * Function to add the necessary authentication
31
     * to the request.
32
     *
33
     * @param Request $request Request passed by reference
34
     */
35 1
    public function authenticateRequest($request)
36
    {
37 1
        $username = Config::get('auth.basic.username');
0 ignored issues
show
Bug introduced by
The method get() does not exist on Trucker\Facades\Config. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

37
        /** @scrutinizer ignore-call */ 
38
        $username = Config::get('auth.basic.username');
Loading history...
38 1
        $password = Config::get('auth.basic.password');
39 1
        $request->setAuth($username, $password);
40 1
    }
41
}
42