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 (#35)
by Dwight
01:18
created

ApnConnection::close()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use ZendService\Apple\Apns\Message;
6
use ZendService\Apple\Apns\Client\Message as Client;
7
use NotificationChannels\Apn\Exceptions\ConnectionFailed;
8
9
class ApnConnection
10
{
11
    /**
12
     * The sandbox environment identifier.
13
     *
14
     * @var int
15
     */
16
    const SANDBOX = 0;
17
18
    /**
19
     * The production environment identifier.
20
     *
21
     * @var int
22
     */
23
    const PRODUCTION = 1;
24
25
    /**
26
     * The APNS client.
27
     *
28
     * @var \ZendService\Apple\Apns\Client\Message
29
     */
30
    protected $client;
31
32
    /**
33
     * Create a new connection instance.
34
     *
35
     * @param  \ZendService\Apple\Apns\Client\Message  $client
36
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
37
     */
38
    public function __construct(Client $client)
39
    {
40
        $this->client = $client;
41
    }
42
43
    /**
44
     * Open a new connection.
45
     *
46
     * @param  string  $environment
47
     * @param  string  $certificate
48
     * @param  string  $passPhrase
49
     * @return void
50
     * @throws \NotificationChannels\Apn\Exceptions\ConnectionFailed
51
     */
52
    public function open($environment, $certificate, $passPhrase = null)
53
    {
54
        try {
55
            $this->client->open($environment, $certificate, $passPhrase);
56
        } catch (Exception $exception) {
0 ignored issues
show
Bug introduced by
The class NotificationChannels\Apn\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
57
            throw ConnectionFailed::create($exception);
58
        }
59
    }
60
61
    /**
62
     * Send the provided packet over the existing connection.
63
     *
64
     * @param  \ZendService\Apple\Apns\Message  $message
0 ignored issues
show
Bug introduced by
There is no parameter named $message. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
65
     * @return \ZendService\Apple\Apns\Response\Message
66
     */
67
    public function send(Message $packet)
68
    {
69
        return $this->client->send($packet);
70
    }
71
72
    /**
73
     * Close the existing connection.
74
     *
75
     * @return void
76
     */
77
    public function close()
78
    {
79
        $this->client->close();
80
    }
81
}
82