MailboxBasicAuthentication   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 12
rs 10
c 1
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 3
1
<?php
2
3
namespace BeyondCode\Mailbox\Http\Middleware;
4
5
use Closure;
6
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
7
8
class MailboxBasicAuthentication
9
{
10
    public function handle($request, Closure $next)
11
    {
12
        $user = $request->getUser();
13
        $password = $request->getPassword();
14
15
        if ($user === config('mailbox.basic_auth.username') && $password === config('mailbox.basic_auth.password')) {
16
            return $next($request);
17
        }
18
19
        throw new UnauthorizedHttpException('Laravel Mailbox');
20
    }
21
}
22