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

WordPoints_Hook_Extension_Blocker   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate_action_type_settings() 0 3 1
A should_hit() 0 3 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