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 (#37)
by Dwight
08:34
created

ApnServiceProvider::boot()   B

Complexity

Conditions 3
Paths 1

Size

Total Lines 40
Code Lines 26

Duplication

Lines 30
Ratio 75 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 30
loc 40
ccs 0
cts 33
cp 0
rs 8.8571
cc 3
eloc 26
nc 1
nop 0
crap 12
1
<?php
2
3
namespace NotificationChannels\Apn;
4
5
use Illuminate\Support\ServiceProvider;
6
use ZendService\Apple\Apns\Client\Message;
7
use ZendService\Apple\Apns\Client\Feedback;
8
9
class ApnServiceProvider extends ServiceProvider
10
{
11
    public function boot()
12
    {
13
        $credentials = $this->app->make(ApnCredentials::class);
14
15
        $this->app->when(ApnChannel::class)
16
            ->needs(Message::class)
17 View Code Duplication
            ->give(function ($app) use ($credentials) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
                $client = new Message;
19
20
                try {
21
                    $client->open(
22
                        $credentials->environment(),
23
                        $credentials->certificate(),
24
                        $credentials->passPhrase()
25
                    );
26
                } 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...
27
                    throw ConnectionFailed::create($exception);
28
                }
29
30
                return $client;
31
            });
32
33
        $this->app->when(FeedbackService::class)
34
            ->needs(Feedback::class)
35 View Code Duplication
            ->give(function ($app) use ($credentials) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
                $client = new Feedback;
37
38
                try {
39
                    $client->open(
40
                        $credentials->environment(),
41
                        $credentials->certificate(),
42
                        $credentials->passPhrase()
43
                    );
44
                } 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...
45
                    throw ConnectionFailed::create($exception);
46
                }
47
48
                return $client;
49
            });
50
    }
51
}
52