OauthTokensClientServiceProvider   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 7

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 2
A register() 0 4 2
A getProvider() 0 9 2
A __construct() 0 5 1
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