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 — rewrite ( 8f702b...4eac2f )
by Peter
05:31 queued 03:46
created

PoniverseServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 3 1
A register() 0 12 1
A provides() 0 4 1
1
<?php
2
3
namespace Poniverse\Lib;
4
5
use GuzzleHttp\Client as HttpClient;
6
use Illuminate\Contracts\Console\Application;
7
use Illuminate\Support\ServiceProvider;
8
use Poniverse\Lib\Client;
9
10
class PoniverseServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Indicates if loading of the provider is deferred.
14
     *
15
     * @var bool
16
     */
17
    protected $defer = false;
18
19
    /**
20
     * Bootstrap the application events.
21
     */
22
    public function boot()
23
    {
24
    }
25
26
    /**
27
     * Register the service provider.
28
     */
29
    public function register()
30
    {
31
        $this->app->singleton('poniverse.api', function (Application $app) {
32
            $config = $app['config']->get('poniverse/api::config');
0 ignored issues
show
Unused Code introduced by
$config is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
33
34
            $client = new Client(new HttpClient());
0 ignored issues
show
Bug introduced by
The call to Client::__construct() misses some required arguments starting with $clientSecret.
Loading history...
Documentation introduced by
new \GuzzleHttp\Client() is of type object<GuzzleHttp\Client>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35
36
            return $client;
37
        });
38
39
        $this->app->bind(Client::class, 'poniverse.api');
40
    }
41
42
    /**
43
     * Get the services provided by the provider.
44
     *
45
     * @return string[]
46
     */
47
    public function provides()
48
    {
49
        return ['poniverse.api'];
50
    }
51
}
52