Completed
Push — master ( ea7c62...226003 )
by J.D.
03:16
created

WordPoints_Hook_Extension_Blocker::should_hit()   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
/**
4
 * Blocker hook extension class.
5
 *
6
 * @package wordpoints-hooks-api
7
 * @since 1.0.0
8
 */
9
10
/**
11
 * Blocks a fire from hitting.
12
 *
13
 * Useful when you want to block fires of a specific action type for a reaction.
14
 *
15
 * @since 1.0.0
16
 */
17
class WordPoints_Hook_Extension_Blocker extends WordPoints_Hook_Extension {
18
19
	/**
20
	 * @since 1.0.0
21
	 */
22
	protected $slug = 'blocker';
23
24
	/**
25
	 * @since 1.0.0
26
	 */
27
	public function validate_action_type_settings( $settings ) {
28
		return (bool) $settings;
29
	}
30
31
	/**
32
	 * @since 1.0.0
33
	 */
34
	public function should_hit( WordPoints_Hook_Fire $fire ) {
35
		return ! $this->get_settings_from_fire( $fire );
36
	}
37
}
38
39
// EOF
40