Passed
Push — master ( c298dd...c4dd8e )
by Alain
24:29
created

StyleHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get_register_function() 0 3 1
A is_registered() 0 3 1
A get_enqueue_function() 0 3 1
1
<?php
2
/**
3
 * StyleHandler Class.
4
 *
5
 * @package   BrightNucleus\Dependency
6
 * @author    Alain Schlesser <[email protected]>
7
 * @license   GPL-2.0+
8
 * @link      http://www.brightnucleus.com/
9
 * @copyright 2015 Alain Schlesser, Bright Nucleus
10
 */
11
12
namespace BrightNucleus\Dependency;
13
14
/**
15
 * StyleHandler dependency.
16
 *
17
 * @since   0.1.0
18
 *
19
 * @package BrightNucleus\Dependency
20
 */
21
class StyleHandler extends AbstractDependencyHandler {
22
23
	/**
24
	 * Get the name of the function that is used for registering the dependency.
25
	 *
26
	 * @since 0.1.0
27
	 *
28
	 * @return string Function name.
29
	 */
30
	protected function get_register_function() {
31
		return 'wp_register_style';
32
	}
33
34
	/**
35
	 * Check whether a specific handle has been registered.
36
	 *
37
	 * @since 0.2.3
38
	 *
39
	 * @param string $handle The handle to check
40
	 * @return bool Whether it is registered or not.
41
	 */
42
	protected function is_registered( $handle ) {
43
		return \wp_style_is( $handle );
44
	}
45
46
	/**
47
	 * Get the name of the function that is used for enqueueing the dependency.
48
	 *
49
	 * @since 0.1.0
50
	 *
51
	 * @return string Function name.
52
	 */
53
	protected function get_enqueue_function() {
54
		return 'wp_enqueue_style';
55
	}
56
}
57