Test Failed
Push — travis/4010 ( cd7197 )
by Ravinder
12:19
created

Give_Stripe   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A includes() 0 22 1
A register_gateway() 0 9 1
1
<?php
2
/**
3
 * Give - Stripe Core
4
 *
5
 * @since 2.5.0
6
 *
7
 * @package    Give
8
 * @subpackage Stripe Core
9
 * @copyright  Copyright (c) 2019, GiveWP
10
 * @license    https://opensource.org/licenses/gpl-license GNU Public License
11
 */
12
13
// Exit, if accessed directly.
14
if ( ! defined( 'ABSPATH' ) ) {
15
	exit;
16
}
17
18
if ( ! class_exists( 'Give_Stripe' ) ) {
19
20
	class Give_Stripe {
21
22
		/**
23
		 * Give_Stripe() constructor.
24
		 *
25
		 * @since  2.5.0
26
		 * @access public
27
		 *
28
		 * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
29
		 */
30
		public function __construct() {
31
32
			add_filter( 'give_payment_gateways', array( $this, 'register_gateway' ) );
33
34
			$this->includes();
35
		}
36
37
		/**
38
		 * This function is used to include the related Stripe core files.
39
		 *
40
		 * @since  2.5.0
41
		 * @access public
42
		 *
43
		 * @return void
44
		 */
45
		public function includes() {
46
47
			require_once GIVE_PLUGIN_DIR . 'vendor/autoload.php';
48
49
			// Include admin files.
50
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/admin/admin-actions.php';
51
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/admin/admin-filters.php';
52
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/admin/class-give-stripe-admin-settings.php';
53
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/admin/class-give-stripe-logs.php';
54
55
			// Include frontend files.
56
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/give-stripe-helpers.php';
57
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/actions.php';
58
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/class-give-stripe-customer.php';
59
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/class-give-stripe-payment-intent.php';
60
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/class-give-stripe-gateway.php';
61
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/class-give-stripe-webhooks.php';
62
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/payment-methods/class-give-stripe-card.php';
63
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/give-stripe-scripts.php';
64
			require_once GIVE_PLUGIN_DIR . 'includes/gateways/stripe/includes/deprecated/deprecated-functions.php';
65
66
		}
67
68
		/**
69
		 * Register the payment methods supported by Stripe.
70
		 *
71
		 * @access public
72
		 * @since  2.5.0
73
		 *
74
		 * @param array $gateways List of registered gateways.
75
		 *
76
		 * @return array
77
		 */
78
		public function register_gateway( $gateways ) {
79
80
			$gateways['stripe'] = array(
81
				'admin_label'    => __( 'Stripe - Credit Card', 'give' ),
82
				'checkout_label' => __( 'Credit Card', 'give' ),
83
			);
84
85
			return $gateways;
86
		}
87
88
	}
89
}
90
91
new Give_Stripe();
92