Passed
Pull Request — master (#194)
by
unknown
02:29
created

IllegalMailbox::getResponseCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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 2
    public function __construct($responseCode)
23
    {
24 2
        parent::__construct();
25
26 2
        $this->responseCode = $responseCode;
27 2
    }
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