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.

ServiceFeedbackClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendRequest() 0 13 2
1
<?php
2
3
/*
4
 * (c) Alexander Zhukov <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Zbox\UnifiedPush\NotificationService\APNS;
11
12
use Zbox\UnifiedPush\Exception\ClientException;
13
14
/**
15
 * Class ServiceFeedbackClient
16
 * @package Zbox\UnifiedPush\NotificationService\APNS
17
 */
18
class ServiceFeedbackClient extends ServiceClient
19
{
20
    /**
21
     * APN Feedback service give you information about failed push notifications
22
     *
23
     * @param array|null $notification
24
     * @throws ClientException
25
     * @return bool
26
     */
27
    /**
28
     * @return \ArrayIterator
29
     */
30
    public function sendRequest()
31
    {
32
        try {
33
            $connection    = $this->getClientConnection();
34
            $feedbackData  = $connection->read(-1);
35
            $connection->disconnect();
36
37
        } catch (\Exception $e) {
38
            throw new ClientException($e->getMessage());
39
        }
40
41
        return new ResponseFeedback($feedbackData, new \ArrayIterator());
0 ignored issues
show
Security Bug introduced by
It seems like $feedbackData defined by $connection->read(-1) on line 34 can also be of type false; however, Zbox\UnifiedPush\Notific...Feedback::__construct() does only seem to accept string, did you maybe forget to handle an error condition?

This check looks for type mismatches where the missing type is false. This is usually indicative of an error condtion.

Consider the follow example

<?php

function getDate($date)
{
    if ($date !== null) {
        return new DateTime($date);
    }

    return false;
}

This function either returns a new DateTime object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returned false before passing on the value to another function or method that may not be able to handle a false.

Loading history...
42
    }
43
}
44