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
Push — master ( d4bbbf...cc8a32 )
by Dwight
8s
created

FeedbackService   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 4
c 4
b 1
f 0
lcom 1
cbo 3
dl 0
loc 61
ccs 16
cts 16
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 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  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