ContactChecker::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
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