DomainManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 8 1
A fetchRecord() 0 13 1
1
<?php
2
3
namespace PeterNijssen\Ses\Manager;
4
5
use Aws\Ses\SesClient;
6
use PeterNijssen\Ses\Model\Dns;
7
use PeterNijssen\Ses\Model\DomainIdentity;
8
9
/**
10
 * This manager handles domain identities
11
 */
12
class DomainManager extends SesManager
13
{
14
    /**
15
     * Constructor
16
     *
17
     * @param SesClient      $sesClient
18
     * @param DomainIdentity $identity
19
     */
20 9
    public function __construct(SesClient $sesClient, DomainIdentity $identity)
21
    {
22 9
        parent::__construct($sesClient, $identity);
23 9
    }
24
25
    /**
26
     * Create the identity within SES
27
     */
28 1
    public function create()
29
    {
30 1
        $this->sesClient->verifyDomainIdentity(
31
            [
32 1
                'Domain' => $this->identity->getIdentity(),
33
            ]
34 1
        );
35 1
    }
36
37
    /**
38
     * Return the DNS record for the domain
39
     *
40
     * @return Dns
41
     */
42 1
    public function fetchRecord()
43
    {
44 1
        $result = $this->sesClient->verifyDomainIdentity(
45
            [
46 1
                'Domain' => $this->identity->getIdentity(),
47
            ]
48 1
        );
49
50 1
        $value = $result->search("VerificationToken");
51 1
        $name = "_amazonses.".$this->identity->getDomain();
52
53 1
        return new Dns("TXT", $name, $value);
54
    }
55
}
56