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 (#47)
by
unknown
02:10
created

FeedbackService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 5
Bugs 2 Features 0
Metric Value
wmc 4
c 5
b 2
f 0
lcom 1
cbo 3
dl 0
loc 57
ccs 0
cts 20
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A get() 0 10 1
A fetchFeedback() 0 11 2
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  \NotificationChannels\Apn\ApnCredentials  $credentials
23
     */
24
    public function __construct(Client $client, ApnCredentials $credentials)
25
    {
26
        $this->client = $client;
27
        $this->credentials = $credentials;
28
    }
29
30
    /**
31
     * Get feedback from the Apple Feedback Service about failed deliveries.
32
     *
33
     * @return array|ApnFeedback[]
34
     * @throws Exceptions\ConnectionFailed
35
     */
36
    public function get()
37
    {
38
        $this->openConnection();
39
40
        $feedback = $this->fetchFeedback();
41
42
        $this->closeConnection();
43
44
        return $feedback;
45
    }
46
47
    /**
48
     * Fetch the feedback from APNS and collect our feedback object.
49
     *
50
     * @return array
51
     */
52
    protected function fetchFeedback()
53
    {
54
        $feedback = [];
55
56
        /** @var FeedbackResponse $response */
57
        foreach ($this->client->feedback() as $response) {
58
            $feedback[] = new ApnFeedback($response->getToken(), $response->getTime());
59
        }
60
61
        return $feedback;
62
    }
63
}
64