LSX_Customizer_Colour_Control   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 27
c 1
b 0
f 0
dl 0
loc 46
rs 10
wmc 7

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render_content() 0 22 5
A enqueue() 0 10 2
1
<?php
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
2
if ( ! class_exists( 'LSX_Customizer_Colour_Control' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
3
4
	/**
5
	 * LSX Customizer Colour Control Class
6
	 *
7
	 * @package   LSX Customizer
8
	 * @author    LightSpeed
9
	 * @license   GPL3
10
	 * @link
11
	 * @copyright 2016 LightSpeed
12
	 */
13
	class LSX_Customizer_Colour_Control extends WP_Customize_Control {
14
15
		/**
16
		 * Enqueue control related scripts/styles.
17
		 *
18
		 * @since 1.0.0
19
		 */
20
		public function enqueue() {
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
21
			wp_enqueue_script( 'lsx_customizer_colour_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-colour-admin.min.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), LSX_CUSTOMIZER_VER, true );
22
			//wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices );
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices );" but found "//wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices );"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
23
24
			global $customizer_colour_names;
25
			$colors = array();
26
			foreach ( $customizer_colour_names as $key => $value ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
27
				$colors[] = $key;
28
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
29
			wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme_keys', $colors );
30
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
31
32
		/**
33
		 * Render the control's content.
34
		 *
35
		 * @since 1.0.0
36
		 */
37
		public function render_content() {
38
			if ( empty( $this->choices ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
39
				return;
40
			}
41
42
			?>
43
			<label>
44
				<?php if ( ! empty( $this->label ) ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
45
					<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
46
				<?php
47
}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
Coding Style introduced by
Closing brace indented incorrectly; expected 16 spaces, found 0
Loading history...
48
if ( ! empty( $this->description ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
49
					?>
50
					<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
51
				<?php } ?>
0 ignored issues
show
Coding Style introduced by
Closing brace indented incorrectly; expected 0 spaces, found 16
Loading history...
52
				<select <?php $this->link(); ?>>
53
					<?php
54
					foreach ( $this->choices as $value => $label ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
55
							echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_html( $label['label'] ) . '</option>';
56
					}
57
					?>
58
				</select>
59
			</label>
60
		<?php
61
		}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
62
63
	}
64
65
}
66
67