Passed
Push — develop ( 4cbaa0...09ba9e )
by Ngoding
05:32
created

EmailVerificationRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 22
ccs 9
cts 10
cp 0.9
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 17 3
1
<?php
2
3
namespace App\Http\Requests\Auth;
4
5
use Illuminate\Foundation\Auth\EmailVerificationRequest as BaseEmailVerificationRequest;
6
7
/**
8
 * @method \App\Models\User|null user() Get the user making the request.
9
 */
10
class EmailVerificationRequest extends BaseEmailVerificationRequest
11
{
12
    /**
13
     * {@inheritDoc}
14
     */
15 2
    public function authorize()
16
    {
17 2
        if (! hash_equals(
18 2
            (string) $this->route('id'),
19 2
            sha1($this->user()->getKeyForVerification()
20
        ))) {
21
            return false;
22
        }
23
24 2
        if (! hash_equals(
25 2
            (string) $this->route('hash'),
26 2
            sha1($this->user()->getEmailForVerification()
27
        ))) {
28 1
            return false;
29
        }
30
31 1
        return true;
32
    }
33
}
34