Passed
Push — master ( f07f01...23a19f )
by Syed Abidur
01:20 queued 14s
created

OauthTokensClientServiceProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Sarahman\OauthTokensClient;
4
5
use Illuminate\Foundation\Application;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\Application was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Support\ServiceProvider;
7
8
class OauthTokensClientServiceProvider extends ServiceProvider
9
{
10
    protected $provider;
11
12
    public function __construct($app)
13
    {
14
        parent::__construct($app);
15
16
        $this->provider = $this->getProvider();
17
    }
18
19
    public function boot()
20
    {
21
        if (method_exists($this->provider, 'boot')) {
22
            return $this->provider->boot();
23
        }
24
    }
25
26
    public function register()
27
    {
28
        if (method_exists($this->provider, 'register')) {
29
            return $this->provider->register();
30
        }
31
    }
32
33
    private function getProvider()
34
    {
35
        if (version_compare(Application::VERSION, '5.0', '<')) {
36
            $provider = '\Sarahman\OauthTokensClient\ServiceProviderForLaravel4';
37
        } else {
38
            $provider = '\Sarahman\OauthTokensClient\ServiceProviderForLaravelRecent';
39
        }
40
41
        return new $provider($this->app);
42
    }
43
}
44