Completed
Push — master ( 1fd018...1044a6 )
by David
20:21
created

Suppression   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 44
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A bounces() 0 4 1
A complaints() 0 4 1
A unsubscribes() 0 4 1
A whitelists() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2013 Mailgun
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license. See the LICENSE file for details.
10
 */
11
12
namespace Mailgun\Api;
13
14
use Mailgun\Api\Suppression\Bounce;
15
use Mailgun\Api\Suppression\Complaint;
16
use Mailgun\Api\Suppression\Unsubscribe;
17
use Mailgun\Api\Suppression\Whitelist;
18
use Mailgun\HttpClient\RequestBuilder;
19
use Mailgun\Hydrator\Hydrator;
20
use Psr\Http\Client\ClientInterface;
21
22
/**
23
 * @see https://documentation.mailgun.com/api-suppressions.html
24
 *
25
 * @author Sean Johnson <[email protected]>
26
 */
27
class Suppression
28
{
29
    /**
30
     * @var ClientInterface
31
     */
32
    private $httpClient;
33
34
    /**
35
     * @var RequestBuilder
36
     */
37
    private $requestBuilder;
38
39
    /**
40
     * @var Hydrator
41
     */
42
    private $hydrator;
43 3
44
    public function __construct(ClientInterface $httpClient, RequestBuilder $requestBuilder, Hydrator $hydrator)
45 3
    {
46 3
        $this->httpClient = $httpClient;
47 3
        $this->requestBuilder = $requestBuilder;
48 3
        $this->hydrator = $hydrator;
49
    }
50 1
51
    public function bounces(): Bounce
52 1
    {
53
        return new Bounce($this->httpClient, $this->requestBuilder, $this->hydrator);
54
    }
55 1
56
    public function complaints(): Complaint
57 1
    {
58
        return new Complaint($this->httpClient, $this->requestBuilder, $this->hydrator);
59
    }
60 1
61
    public function unsubscribes(): Unsubscribe
62 1
    {
63
        return new Unsubscribe($this->httpClient, $this->requestBuilder, $this->hydrator);
64
    }
65
66
    public function whitelists(): Whitelist
67
    {
68
        return new Whitelist($this->httpClient, $this->requestBuilder, $this->hydrator);
69
    }
70
}
71