Kirki_Field_Multicolor   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A set_type() 0 3 1
A set_choices() 0 5 2
A set_sanitize_callback() 0 8 2
A sanitize() 0 2 1
1
<?php
2
/**
3
 * Override field methods
4
 *
5
 * @package     Kirki
6
 * @subpackage  Controls
7
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
8
 * @license    https://opensource.org/licenses/MIT
9
 * @since       2.2.7
10
 */
11
12
/**
13
 * Field overrides.
14
 */
15
class Kirki_Field_Multicolor extends Kirki_Field {
16
17
	/**
18
	 * Sets the control type.
19
	 *
20
	 * @access protected
21
	 */
22
	protected function set_type() {
23
24
		$this->type = 'kirki-multicolor';
25
26
	}
27
28
	/**
29
	 * Sets the $choices
30
	 *
31
	 * @access protected
32
	 */
33
	protected function set_choices() {
34
35
		// Make sure choices are defined as an array.
36
		if ( ! is_array( $this->choices ) ) {
0 ignored issues
show
introduced by
The condition is_array($this->choices) is always true.
Loading history...
37
			$this->choices = array();
38
		}
39
40
	}
41
42
	/**
43
	 * Sets the $sanitize_callback
44
	 *
45
	 * @access protected
46
	 */
47
	protected function set_sanitize_callback() {
48
49
		// If a custom sanitize_callback has been defined,
50
		// then we don't need to proceed any further.
51
		if ( ! empty( $this->sanitize_callback ) ) {
52
			return;
53
		}
54
		$this->sanitize_callback = array( $this, 'sanitize' );
55
56
	}
57
58
	/**
59
	 * The method that will be used as a `sanitize_callback`.
60
	 *
61
	 * @param array $value The value to be sanitized.
62
	 * @return array The value.
63
	 */
64
	public function sanitize( $value ) {
65
		return $value;
66
	}
67
}
68