Passed
Push — add/multiplan ( e46fc7...0a2963 )
by Warwick
04:26 queued 12s
created

Exercise::get_instance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 6
rs 10
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\Exercise().
12
 */
13
class Exercise {
14
15
	/**
16
	 * Holds class instance
17
	 *
18
	 * @since 1.0.0
19
	 *
20
	 * @var      object \lsx_health_plan\classes\admin\Exercise()
21
	 */
22
	protected static $instance = null;
23
24
	/**
25
	 * Contructor
26
	 */
27
	public function __construct() {
28
		add_action( 'lsx_hp_settings_page_exercise_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\Exercise()    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
				'id'          => 'exercise_archive_description',
56
				'type'        => 'wysiwyg',
57
				'name'        => __( 'Archive Description', 'lsx-health-plan' ),
58
				'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
59
			)
60
		);
61
	}
62
}
63
Exercise::get_instance();
64