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
02:00
created

FeedbackService::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use ZendService\Apple\Apns\Client\Feedback as Client;
6
7
class FeedbackService
8
{
9
    use InteractsWithConnection;
10
11
    /**
12
     * The feedback client instance.
13
     *
14
     * @var \ZendService\Apple\Apns\Client\Feedback
15
     */
16
    protected $client;
17
18
    /**
19
     * Create feedback service instance.
20
     *
21
     * @param  \ZendService\Apple\Apns\Client\Feedback  $client
22
     * @param  string  $environment
23
     * @param  string  $certificate
24
     * @param  string|null  $passPhrase
25
     */
26 1
    public function __construct(Client $client, $environment, $certificate, $passPhrase = null)
27
    {
28 1
        $this->client = $client;
29 1
        $this->environment = $environment;
30 1
        $this->certificate = $certificate;
31 1
        $this->passPhrase = $passPhrase;
32 1
    }
33
34
    /**
35
     * Get feedback from the Apple Feedback Service about failed deliveries.
36
     *
37
     * @return array|ApnFeedback[]
38
     * @throws Exceptions\ConnectionFailed
39
     */
40 1
    public function get()
41
    {
42 1
        $this->openConnection();
43
44 1
        $feedback = $this->fetchFeedback();
45
46 1
        $this->closeConnection();
47
48 1
        return $feedback;
49
    }
50
51
    /**
52
     * Fetch the feedback from APNS and collect our feedback object.
53
     *
54
     * @return array
55
     */
56 1
    protected function fetchFeedback()
57
    {
58 1
        $feedback = [];
59
60
        /** @var FeedbackResponse $response */
61 1
        foreach ($this->client->feedback() as $response) {
62 1
            $feedback[] = new ApnFeedback($response->getToken(), $response->getTime());
63
        }
64
65 1
        return $feedback;
66
    }
67
}
68