YandexCheckoutServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 13
c 3
b 1
f 0
dl 0
loc 25
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A boot() 0 14 3
1
<?php
2
3
namespace Orkhanahmadov\YandexCheckout;
4
5
use Illuminate\Support\ServiceProvider;
6
use Orkhanahmadov\YandexCheckout\Commands\CheckPaymentCommand;
7
8
class YandexCheckoutServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        if ($this->app->runningInConsole()) {
13
            $this->publishes([
14
                __DIR__ . '/../config/config.php' => config_path('yandex-checkout.php'),
15
            ], 'config');
16
17
            if (! class_exists('CreateYandexCheckoutsTable')) {
18
                $this->publishes([
19
                    __DIR__ . '/../database/migrations/yandex_checkouts_table.php.stub' => database_path('migrations/' . date('Y_m_d_His') . '_create_yandex_checkouts_table.php'),
20
                ], 'migrations');
21
            }
22
23
            $this->commands([CheckPaymentCommand::class]);
24
        }
25
    }
26
27
    public function register()
28
    {
29
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'yandex-checkout');
30
31
        $this->app->singleton('yandex-checkout', function () {
32
            return $this->app->make(YandexCheckoutService::class);
33
        });
34
    }
35
}
36