GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Failed Conditions
Push — master ( 550dab...bc8237 )
by Casper
03:45 queued 02:01
created

ValidatorsClient   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 55
ccs 17
cts 17
cp 1
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A phone() 0 23 4
A email() 0 6 1
1
<?php
2
3
namespace NStack\Clients;
4
5
use NStack\Exceptions\FailedToParseException;
6
use NStack\Models\EmailValidation;
7
use NStack\Models\IpAddress;
8
use NStack\Models\PhoneValidation;
9
10
/**
11
 * Class ValidatorsClient
12
 *
13
 * @package NStack\Clients
14
 * @author Tiago Araujo <[email protected]>
15
 */
16
class ValidatorsClient extends NStackClient
17
{
18
    /** @var string */
19
    protected $path = 'validator';
20
21
    /**
22
     * email
23
     *
24
     * @param String $email
25
     * @return EmailValidation
26
     * @throws FailedToParseException
27
     * @author  Tiago Araujo <[email protected]>
28
     */
29 1
    public function email(String $email): EmailValidation
30
    {
31 1
        $response = $this->client->get($this->buildPath($this->path . '/email?email=' . $email));
32 1
        $contents = $response->getBody()->getContents();
33 1
        $data = json_decode($contents, true);
34 1
        return new EmailValidation($data);
35
    }
36
37
    /**
38
     * phone
39
     *
40
     * @param String $phone
41
     * @param String|null $fallbackCountryCode
42
     * @param Boolean|null $validateWithTwilio
43
     * @param String|null $twilioType
44
     * @return PhoneValidation
45
     * @throws FailedToParseException
46
     * @author  Tiago Araujo <[email protected]>
47
     */
48 1
    public function phone(
49
        String $phone,
50
        String $fallbackCountryCode = null,
51
        bool $validateWithTwilio = null,
52
        String $twilioType = null
53
    ): PhoneValidation
54
    {
55 1
        $path = $this->buildPath($this->path . '/phone?phone=' . $phone);
56
57 1
        if ($fallbackCountryCode) {
58 1
            $path = $path . '&fallback_country_code=' . $fallbackCountryCode;
59
        }
60 1
        if ($validateWithTwilio) {
61 1
            $path = $path . '&twilio=' . $validateWithTwilio;
0 ignored issues
show
Bug introduced by
Are you sure $validateWithTwilio of type true can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

61
            $path = $path . '&twilio=' . /** @scrutinizer ignore-type */ $validateWithTwilio;
Loading history...
62
        }
63 1
        if ($twilioType) {
64 1
            $path = $path . '&twilio_type=' . $twilioType;
65
        }
66
67 1
        $response = $this->client->get($path);
68 1
        $contents = $response->getBody()->getContents();
69 1
        $data = json_decode($contents, true);
70 1
        return new PhoneValidation($data);
71
    }
72
}