Completed
Pull Request — master (#17)
by Frederik
02:00
created

ArrayBackend   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 37
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A contains() 0 4 1
A store() 0 4 1
1
<?php
2
3
namespace Genkgo\Mail\Protocol\Smtp\Backend;
4
5
use Genkgo\Mail\EmailAddress;
6
use Genkgo\Mail\MessageInterface;
7
use Genkgo\Mail\Protocol\Smtp\BackendInterface;
8
9
final class ArrayBackend implements BackendInterface
10
{
11
    /**
12
     * @var array
13
     */
14
    private $addresses;
15
16
    /**
17
     * ArrayBackend constructor.
18
     * @param array $addresses
19
     */
20
    public function __construct(array $addresses)
21
    {
22
        $this->addresses = array_combine(
23
            $addresses,
24
            array_fill(0, count($addresses), true)
25
        );
26
    }
27
28
    /**
29
     * @param EmailAddress $mailbox
30
     * @return bool
31
     */
32
    public function contains(EmailAddress $mailbox): bool
33
    {
34
        return isset($this->addresses[(string)$mailbox]);
35
    }
36
37
    /**
38
     * @param EmailAddress $mailbox
39
     * @param MessageInterface $message
40
     */
41
    public function store(EmailAddress $mailbox, MessageInterface $message): void
42
    {
43
        ;
44
    }
45
}