Passed
Push — add/multiplan ( a781ed...bfed9f )
by Warwick
04:45
created

Plan   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
dl 0
loc 48
rs 10
c 1
b 0
f 1
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A settings() 0 9 1
A get_instance() 0 6 2
1
<?php
2
/**
3
 * Contains the settings class for LSX
4
 *
5
 * @package lsx-health-plan
6
 */
7
8
namespace lsx_health_plan\classes\admin;
9
10
/**
11
 * Contains the settings for each post type \lsx_health_plan\classes\admin\Plan().
12
 */
13
class Plan {
14
15
	/**
16
	 * Holds class instance
17
	 *
18
	 * @since 1.0.0
19
	 *
20
	 * @var      object \lsx_health_plan\classes\admin\Plan()
21
	 */
22
	protected static $instance = null;
23
24
	/**
25
	 * Contructor
26
	 */
27
	public function __construct() {
28
		add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 );
29
	}
30
31
	/**
32
	 * Return an instance of this class.
33
	 *
34
	 * @since 1.0.0
35
	 *
36
	 * @return    object \lsx_health_plan\classes\admin\Plan()    A single instance of this class.
37
	 */
38
	public static function get_instance() {
39
		// If the single instance hasn't been set, set it now.
40
		if ( null === self::$instance ) {
41
			self::$instance = new self();
42
		}
43
		return self::$instance;
44
	}
45
46
	/**
47
	 * Registers the general settings.
48
	 *
49
	 * @param object $cmb new_cmb2_box().
50
	 * @return void
51
	 */
52
	public function settings( $cmb ) {
53
		$cmb->add_field(
54
			array(
55
				'name'        => __( 'Plan Filters', 'lsx-health-plan' ),
56
				'id'          => 'plan_filters_disabled',
57
				'type'        => 'checkbox',
58
				'value'       => 1,
59
				'default'     => 0,
60
				'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ),
61
			)
62
		);
63
	}
64
}
65
Plan::get_instance();
66