Test Failed
Pull Request — master (#194)
by
unknown
02:39
created

IllegalMailbox   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getResponseCode() 0 4 1
A __toString() 0 9 1
1
<?php
2
3
namespace Egulias\EmailValidator\Validation\Error;
4
5
use Egulias\EmailValidator\Exception\InvalidEmail;
6
7
class IllegalMailbox extends InvalidEmail
8
{
9
    const CODE = 995;
10
    const REASON = "The mailbox is illegal.";
11
12
    /**
13
     * @var int
14
     */
15
    private $responseCode;
16
17
    /**
18
     * IllegalMailbox constructor.
19
     *
20
     * @param int $responseCode
21
     */
22
    public function __construct($responseCode)
23
    {
24
        parent::__construct();
25
26
        $this->responseCode = $responseCode;
27
    }
28
29
    /**
30
     * @return int
31
     */
32
    public function getResponseCode()
33
    {
34
        return $this->responseCode;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function __toString()
41
    {
42
        return sprintf(
43
            "%s SMTP response code: %s. Internal code: %s.",
44
            $this->message,
45
            $this->responseCode,
46
            $this->code
47
        );
48
    }
49
}
50