SettingSection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 54
ccs 0
cts 2
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A add_field() 0 2 1
1
<?php namespace EmailLog\Core\UI\Setting;
2
3
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
4
5
/**
6
 * A Section used in Email Log Settings page.
7
 * Ideally each add-on may have a different setting section.
8
 *
9
 * @see add_settings_section()
10
 * @since 2.0.0
11
 */
12
class SettingSection {
13
14
	public $id;
15
	public $title;
16
	public $callback;
17
18
	/**
19
	 * Each section will have a single option name and the value will be array.
20
	 * All individual fields will be stored as an element in the value array.
21
	 *
22
	 * @var string
23
	 */
24
	public $option_name;
25
26
	/**
27
	 * Sanitize callback for the setting.
28
	 * An array will be passed to this callback.
29
	 *
30
	 * @var callable
31
	 */
32
	public $sanitize_callback;
33
34
	/**
35
	 * List of fields for this section.
36
	 *
37
	 * @var SettingField[]
38
	 */
39
	public $fields = array();
40
41
	/**
42
	 * Default value of the fields.
43
	 *
44
	 * @var array
45
	 *
46
	 * @since 2.1.0
47
	 */
48
	public $default_value = array();
49
50
	/**
51
	 * Field labels.
52
	 *
53
	 * @var array
54
	 *
55
	 * @since 2.1.0
56
	 */
57
	public $field_labels = array();
58
59
	/**
60
	 * Add a field to the section.
61
	 *
62
	 * @param \EmailLog\Core\UI\Setting\SettingField $field Field to add.
63
	 */
64
	public function add_field( SettingField $field ) {
65
		$this->fields[] = $field;
66
	}
67
}
68