Issues (27)

src/Providers/ChargifyServiceProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Srmklive\Chargify\Providers;
4
5
/*
6
 * Class ChargifyServiceProvider
7
 * @package Srmklive\Chargify
8
 */
9
10
use Illuminate\Support\ServiceProvider;
11
use Srmklive\Chargify\Services\ChargifyClient;
12
13
class ChargifyServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Indicates if loading of the provider is deferred.
17
     *
18
     * @var bool
19
     */
20
    protected $defer = false;
21
22
    /**
23
     * Bootstrap the application events.
24
     *
25
     * @return void
26
     */
27
    public function boot()
28
    {
29
        // Publish config files
30
        $this->publishes([
31
            __DIR__.'/../../config/config.php' => config_path('chargify.php'),
0 ignored issues
show
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

31
            __DIR__.'/../../config/config.php' => /** @scrutinizer ignore-call */ config_path('chargify.php'),
Loading history...
32
        ]);
33
    }
34
35
    /**
36
     * Register the service provider.
37
     *
38
     * @return void
39
     */
40
    public function register()
41
    {
42
        $this->registerPayPal();
43
44
        $this->mergeConfig();
45
    }
46
47
    /**
48
     * Register the application bindings.
49
     *
50
     * @return void
51
     */
52
    private function registerPayPal()
53
    {
54
        $this->app->singleton('chargify', static function () {
55
            return new ChargifyClient();
56
        });
57
    }
58
59
    /**
60
     * Merges user's and paypal's configs.
61
     *
62
     * @return void
63
     */
64
    private function mergeConfig()
65
    {
66
        $this->mergeConfigFrom(
67
            __DIR__.'/../../config/config.php',
68
            'chargify'
69
        );
70
    }
71
}
72