ContactChecker   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A hasNoBlockedEmail() 0 13 3
1
<?php
2
3
namespace Dekalee\MailjetBundle\Checker;
4
5
use Mailjet\Client;
6
7
/**
8
 * Class ContactChecker.
9
 */
10
class ContactChecker
11
{
12
    protected $client;
13
14
    /**
15
     * @param Client $client
16
     */
17 4
    public function __construct(Client $client)
18
    {
19 4
        $this->client = $client;
20 4
    }
21
22
    /**
23
     * @param $email
24
     *
25
     * @return mixed
26
     */
27 3
    public function hasNoBlockedEmail($email)
28
    {
29 3
        $response = $this->client->get(['contactstatistics', $email]);
30 3
        if (!$response->success()) {
31 1
            return 'error';
32
        }
33 2
        $blockedCount = $response->getBody();
34 2
        if ($blockedCount['Data'][0]['BlockedCount']) {
35 1
            return false;
36
        }
37
38 1
        return true;
39
    }
40
}
41