Completed
Pull Request — master (#22)
by James
15:13 queued 02:42
created

Annotatable::action_hooks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
	public function filter_hooks() {
20
		return HooksReader::read( $this, function( $annotation ) {
21
			return $annotation instanceof Annotation\Filter;
22
		});
23
	}
24
25
	/**
26
	 * Read the class methods and return the action hooks.
27
	 *
28
	 * @return array
29
	 */
30
	public function action_hooks() {
31
		return HooksReader::read( $this, function( $annotation ) {
32
			return $annotation instanceof Annotation\Action;
33
		});
34
	}
35
}
36