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

ServiceProviderForLaravelRecent::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
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