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

ScriptHandler::is_registered()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * ScriptHandler 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
 * ScriptHandler class.
16
 *
17
 * @since   0.1.0
18
 *
19
 * @package BrightNucleus\Dependency
20
 */
21
class ScriptHandler 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_script';
32
	}
33
34
	/**
35
	 * Get the name of the function that is used for enqueueing the dependency.
36
	 *
37
	 * @since 0.1.0
38
	 *
39
	 * @return string Function name.
40
	 */
41
	protected function get_enqueue_function() {
42
		return 'wp_enqueue_script';
43
	}
44
45
	/**
46
	 * Check whether a specific handle has been registered.
47
	 *
48
	 * @since 0.2.3
49
	 *
50
	 * @param string $handle The handle to check
51
	 * @return bool Whether it is registered or not.
52
	 */
53
	protected function is_registered( $handle ) {
54
		return \wp_script_is( $handle );
55
	}
56
}
57