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

ServiceProviderForLaravelRecent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
A boot() 0 6 1
1
<?php
2
3
namespace Sarahman\OauthTokensClient;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\ServiceProvider;
7
8
class ServiceProviderForLaravelRecent extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        // Publishes the configuration file
13
        $this->publishes([
14
            __DIR__ . '/config/config.php' => config_path('oauth-tokens-client.php'),
0 ignored issues
show
Bug introduced by
The function config_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
            __DIR__ . '/config/config.php' => /** @scrutinizer ignore-call */ config_path('oauth-tokens-client.php'),
Loading history...
15
        ], 'config');
16
    }
17
18
    public function register()
19
    {
20
        // Merges default configuration
21
        $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'oauth-tokens-client');
22
23
        $this->app->bind('oauth-tokens-client.service', function ($app) {
24
            $oauthTokenConfig = $app->make('config')->get('oauth-tokens-client');
25
26
            return new OAuthClient(
27
                new Client,
28
                $app['cache.store'],
29
                $oauthTokenConfig['OAUTH_CREDENTIAL'],
30
                $oauthTokenConfig['TOKEN_PREFIXES'],
31
                $oauthTokenConfig['LOCK_KEY']
32
            );
33
        });
34
    }
35
}
36