InvalidEmailException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace GloBee\PaymentApi\Exceptions\Validation;
4
5
class InvalidEmailException extends ValidationException
6
{
7
    /**
8
     * InvalidEmailException constructor.
9
     *
10
     * @param string $field
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
11
     * @param string $email
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
12
     */
13 2
    public function __construct($field, $email)
0 ignored issues
show
Coding Style introduced by
Type hint "string" missing for $field
Loading history...
Coding Style introduced by
Type hint "string" missing for $email
Loading history...
14
    {
15 2
        $message = sprintf('The %s must be a valid email address.', $field);
16
        $error = [
17 2
            'type' => 'invalid_email',
18
            'extra' => null,
19 2
            'field' => $field,
20 2
            'message' => $message,
21
        ];
22 2
        parent::__construct([$error], $message);
23 2
    }
24
}
25