Completed
Push — master ( 479d34...76ed5d )
by James
16s queued 14s
created

Annotatable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A filter_hooks() 0 5 1
A action_hooks() 0 5 1
1
<?php
2
namespace Intraxia\Jaxion\Core;
3
4
/**
5
 * Trait Annotatable.
6
 *
7
 * Satisfies the Has{Actions,Filters} interface using method annotations.
8
 *
9
 * @package    Intraxia\Jaxion
10
 * @subpackage Core
11
 */
12
trait Annotatable {
13
14
	/**
15
	 * Read the class methods and return the filter hooks.
16
	 *
17
	 * @return array
18
	 */
19 10
	public function filter_hooks() {
20 5
		return HooksReader::read( $this, function( $annotation ) {
21 12
			return $annotation instanceof Annotation\Filter;
22 15
		});
23
	}
24
25
	/**
26
	 * Read the class methods and return the action hooks.
27
	 *
28
	 * @return array
29
	 */
30
	public function action_hooks() {
31 15
		return HooksReader::read( $this, function( $annotation ) {
32 12
			return $annotation instanceof Annotation\Action;
33 15
		});
34
	}
35
}
36