Completed
Pull Request — master (#42)
by Frederik
02:22
created

AbstractMailbox::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol\Imap;
5
6
abstract class AbstractMailbox
7
{
8
    /**
9
     * @var string
10
     */
11
    private $name;
12
13
    /**
14
     *
15
     */
16
    protected const RFC_3501_FIXED = [
17
        "INBOX" => true,
18
    ];
19
20
    /**
21
     * Mailbox constructor.
22
     * @param string $name
23
     */
24
    final public function __construct(string $name)
25
    {
26
        $this->validate($name);
27
        $this->name = $name;
28
    }
29
30
    /**
31
     * @param string $name
32
     */
33
    abstract protected function validate(string $name): void;
34
35
    /**
36
     * @return string
37
     */
38
    public function __toString(): string
39
    {
40
        return $this->name;
41
    }
42
43
}