Completed
Branch main (ba6a8e)
by Michael
01:19
created

Hunter   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 5
dl 0
loc 48
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A account() 0 8 1
A domainSearch() 0 7 2
A emailCount() 0 7 2
A emailFinder() 0 7 2
A emailVerifier() 0 4 1
A verifyEmail() 0 4 1
1
<?php
2
3
namespace Messerli90\Hunterio;
4
5
class Hunter extends HunterClient
6
{
7
    public function account()
8
    {
9
        $this->endpoint = 'account';
10
        $this->query_params = [
11
            'api_key' => $this->api_key ?? null
12
        ];
13
        return $this->get();
14
    }
15
16
    public function domainSearch($domain = null)
17
    {
18
        if (!$domain) {
19
            return new DomainSearch($this->api_key);
20
        }
21
        return (new DomainSearch($this->api_key))->domain($domain)->get();
22
    }
23
24
    public function emailCount($domain = null)
25
    {
26
        if (!$domain) {
27
            return new EmailCount($this->api_key);
0 ignored issues
show
Unused Code introduced by
The call to EmailCount::__construct() has too many arguments starting with $this->api_key.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
28
        }
29
        return (new EmailCount($this->api_key))->domain($domain)->get();
0 ignored issues
show
Unused Code introduced by
The call to EmailCount::__construct() has too many arguments starting with $this->api_key.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
30
    }
31
32
    public function emailFinder($domain = null)
33
    {
34
        if (!$domain) {
35
            return new EmailFinder($this->api_key);
36
        }
37
        return (new EmailFinder($this->api_key))->domain($domain);
38
    }
39
40
    /**
41
     * @deprecated v1.1.0
42
     */
43
    public function emailVerifier()
44
    {
45
        return new EmailVerifier($this->api_key);
46
    }
47
48
    public function verifyEmail($email)
49
    {
50
        return (new EmailVerifier($this->api_key))->verify($email);
51
    }
52
}
53