EmailOccupied::test()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Validation\Rules;
4
5
use Albert221\Validation\Rule\RuleInterface;
6
use Albert221\Validation\Rule\RuleTrait as RuleTrait;
7
use App\Models\User;
8
9 View Code Duplication
class EmailOccupied implements RuleInterface
10
{
11
    use RuleTrait;
12
13
    public function __construct()
14
    {
15
        $this->message = 'Nie istnieje konto o podanym adresie email';
16
    }
17
18
    public function test($value)
19
    {
20
        return User::where('email', $value)->count() !== 0;
21
    }
22
}
23