AValidator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EmailValidator\Validator;
6
7
use EmailValidator\EmailAddress;
8
use EmailValidator\Policy;
9
10
/**
11
 * Abstract base class for email validators
12
 *
13
 * This abstract class provides common functionality for all email validators.
14
 * It implements the IValidator interface and provides access to the validation policy.
15
 */
16
abstract class AValidator implements IValidator
17
{
18
    /**
19
     * The validation policy containing configuration and rules
20
     *
21
     * @var Policy
22
     */
23
    protected Policy $policy;
24
25
    /**
26
     * Constructor for the validator
27
     *
28
     * @param Policy $policy The validation policy to use
29
     */
30
    public function __construct(Policy $policy)
31
    {
32
        $this->policy = $policy;
33
    }
34
35
    /**
36
     * Validates an email address according to specific rules
37
     *
38
     * @param EmailAddress $email The email address to validate
39
     * @return bool True if the email address passes validation, false otherwise
40
     */
41
    abstract public function validate(EmailAddress $email): bool;
42
}
43