Passed
Push — master ( d3fe5e...a81e51 )
by Alex
02:04
created

LarapayServiceProvider::getDatabasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Nxmad\Larapay;
4
5
use Nxmad\Larapay\Contracts\Payments;
6
use Illuminate\Support\ServiceProvider;
7
8
class LarapayServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Register Service Provider.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
        $this->mergeConfigFrom($this->getConfigPath(), 'larapay');
18
19
        $this->app->singleton(Payments::class, function ($app) {
20
            return new GatewayManager($app['config']);
21
        });
22
    }
23
24
    /**
25
     * Boot Service Provider.
26
     *
27
     * @return void
28
     */
29
    public function boot()
30
    {
31
        $this->publishes([
32
            $this->getDatabasePath() => database_path(),
33
            $this->getConfigPath() => config_path('larapay.php'),
34
        ]);
35
36
        $this->loadViewsFrom(__DIR__ . '/../files/views', 'larapay');
37
    }
38
39
    /**
40
     * Get default config path.
41
     *
42
     * @return string
43
     */
44
    protected function getConfigPath(): string
45
    {
46
        return __DIR__ . '/../files/config/larapay.php';
47
    }
48
49
    /**
50
     * Get default database path.
51
     *
52
     * @return string
53
     */
54
    protected function getDatabasePath(): string
55
    {
56
        return __DIR__ . '/../files/database';
57
    }
58
}
59