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.
Completed
Pull Request — master (#46)
by
unknown
08:44
created

InteractsWithConnection::openConnection()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 5.1502

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 22
ccs 9
cts 11
cp 0.8182
rs 8.6737
cc 5
eloc 14
nc 16
nop 3
crap 5.1502
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use Exception;
6
use NotificationChannels\Apn\Exceptions\ConnectionFailed;
7
8
trait InteractsWithConnection
9
{
10
    /**
11
     * The connection credentials.
12
     *
13
     * @var \NotificationChannels\Apn\ApnCredentials
14
     */
15
    protected $credentials;
16
17
    /**
18
     * Open the connection to the feedback service.
19
     *
20
     * @return void
21
     * @throws \NotificationChannels\Apn\Exception\ConnectionFailed
22
     */
23 3
    protected function openConnection($environment = null, $certificate = '',$passphrase = '')
24
    {
25
        if($environment === null) {
26 3
            $environment = $this->credentials->environment();
27 3
        }
28 3
        if(empty($certificate)) {
29 3
            $certificate = $this->credentials->certificate();
30
        }
31
        if(empty($passphrase)) {
32
            $passphrase = $this->credentials->passPhrase();
33
        }
34 3
        
35
        try {
36
            $this->client->open(
0 ignored issues
show
Bug introduced by
The property client does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
37
                $environment,
38
                $certificate,
39
                $passphrase
40
            );
41 3
        } catch (Exception $exception) {
42
            throw ConnectionFailed::create($exception);
43 3
        }
44 3
    }
45
46
    /**
47
     * Close the connection.
48
     *
49
     * @return void
50
     */
51
    protected function closeConnection()
52
    {
53
        $this->client->close();
54
    }
55
}
56