Total Complexity | 10 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 2 | Features | 1 |
1 | <?php |
||
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() |
||
34 | } |
||
35 | |||
36 | public static function isHandlerEnabled(): bool |
||
37 | { |
||
38 | return config('paypal.testing.handler.enabled'); |
||
39 | } |
||
40 | |||
41 | public static function getHandler() |
||
42 | { |
||
43 | return config('paypal.testing.handler.class'); |
||
44 | } |
||
45 | |||
46 | public static function isCheckoutActivated(): bool |
||
49 | } |
||
50 | |||
51 | public static function areSubscriptionsActivated(): bool |
||
52 | { |
||
53 | return config('paypal.subscription.activated'); |
||
54 | } |
||
55 | |||
56 | private static function getCurrentEnvironment() |
||
59 | } |
||
60 | } |
||
61 |