NotNull   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 10
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MiladRahimi\Jwt\Validator\Rules;
6
7
use MiladRahimi\Jwt\Exceptions\ValidationException;
8
use MiladRahimi\Jwt\Validator\Rule;
9
10
/**
11
 * It checks if the claim is not null
12
 */
13
class NotNull implements Rule
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function validate(string $name, $value)
19
    {
20
        if ($value === null) {
21
            $message = "The `$name` must not be null.";
22
            throw new ValidationException($message);
23
        }
24
    }
25
}
26