AppServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 7 1
A register() 0 15 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Support\Facades\Blade;
7
use App\PaymentProvider\Klarna;
8
use App\PaymentProvider\Mollie;
9
use App\PaymentProvider\PayPal;
10
11
class AppServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap any application services.
15
     *
16
     * @return void
17
     */
18
    public function boot()
19
    {
20
        Blade::directive('time', function ($expression) {
21
            return "<?php echo strftime('%H:%M', date_create($expression)->getTimestamp()); ?>";
22
        });
23
        Blade::directive('datetime', function ($expression) {
24
            return "<?php echo strftime('%A, %d.%m.%Y', date_create($expression)->getTimestamp()); ?>";
25
        });
26
    }
27
28
    /**
29
     * Register any application services.
30
     *
31
     * @return void
32
     */
33
    public function register()
34
    {
35
        $this->app->bind('App\PaymentProvider\Klarna', function() {
36
            return new Klarna( config('paymentprovider.sofortConfigKey') );
37
        });
38
39
        $this->app->bind('App\PaymentProvider\PayPal', function() {
40
            return new PayPal(
41
                config('paymentprovider.payPalClientId'),     // ClientID
42
                config('paymentprovider.payPalClientSecret')  // ClientSecret
43
            );
44
        });
45
46
        $this->app->bind('App\PaymentProvider\Mollie', function() {
47
            return new Mollie( config('paymentprovider.mollieApiKey') );
48
        });
49
    }
50
}
51