Passed
Pull Request — master (#9)
by Darío
03:17
created

Environment::getClientId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Pleets\LaravelPayPal\Helpers;
4
5
class Environment
6
{
7
    public const SANDBOX = 'sandbox';
8
    public const LIVE = 'live';
9
    private const API_CONF = 'paypal.api';
10
11
    public static function isSandbox(): bool
12
    {
13
        return self::getCurrentEnvironment() === self::SANDBOX;
14
    }
15
16
    public static function isLive(): bool
17
    {
18
        return self::getCurrentEnvironment() === self::LIVE;
19
    }
20
21
    public static function getClientId()
22
    {
23
        return config(self::API_CONF . '.' . self::getCurrentEnvironment() . '.credentials.client_id');
24
    }
25
26
    public static function getSecret()
27
    {
28
        return config(self::API_CONF . '.' . self::getCurrentEnvironment() . '.credentials.secret');
29
    }
30
31
    public static function getEndpoint()
32
    {
33
        return config(self::API_CONF . '.' . self::getCurrentEnvironment() . '.endpoint');
34
    }
35
36
    public static function isCheckoutActivated(): bool
37
    {
38
        return config('paypal.checkout.activated');
39
    }
40
41
    public static function areSubscriptionsActivated(): bool
42
    {
43
        return config('paypal.subscription.activated');
44
    }
45
46
    private static function getCurrentEnvironment()
47
    {
48
        return config(self::API_CONF . '.environment');
49
    }
50
}
51