@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @return array |
| 18 | 18 | */ |
| 19 | 19 | public function filter_hooks() { |
| 20 | - return HooksReader::read( $this, function( $annotation ) { |
|
| 20 | + return HooksReader::read($this, function($annotation) { |
|
| 21 | 21 | return $annotation instanceof Annotation\Filter; |
| 22 | 22 | }); |
| 23 | 23 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @return array |
| 29 | 29 | */ |
| 30 | 30 | public function action_hooks() { |
| 31 | - return HooksReader::read( $this, function( $annotation ) { |
|
| 31 | + return HooksReader::read($this, function($annotation) { |
|
| 32 | 32 | return $annotation instanceof Annotation\Action; |
| 33 | 33 | }); |
| 34 | 34 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | private function __construct() { |
| 18 | 18 | $this->reader = new AnnotationReader(); |
| 19 | 19 | AnnotationRegistry::registerFile( |
| 20 | - __DIR__ . '/Annotations.php' |
|
| 20 | + __DIR__.'/Annotations.php' |
|
| 21 | 21 | ); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | static private function instance() { |
| 39 | 39 | static $instance; |
| 40 | 40 | |
| 41 | - if ( ! $instance ) { |
|
| 41 | + if (!$instance) { |
|
| 42 | 42 | $instance = new HooksReader(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | * @param \Closure $condition Whether the annotation should be registered. |
| 53 | 53 | * @return array |
| 54 | 54 | */ |
| 55 | - static public function read( $target, $condition ) { |
|
| 55 | + static public function read($target, $condition) { |
|
| 56 | 56 | $reader = static::instance()->reader(); |
| 57 | - $rmethods = (new ReflectionClass( $target ))->getMethods(); |
|
| 57 | + $rmethods = (new ReflectionClass($target))->getMethods(); |
|
| 58 | 58 | |
| 59 | 59 | $hooks = []; |
| 60 | 60 | |
| 61 | - foreach ( $rmethods as $rmethod ) { |
|
| 62 | - foreach ( $reader->getMethodAnnotations( $rmethod ) as $annotation ) { |
|
| 63 | - if ( $condition( $annotation ) ) { |
|
| 61 | + foreach ($rmethods as $rmethod) { |
|
| 62 | + foreach ($reader->getMethodAnnotations($rmethod) as $annotation) { |
|
| 63 | + if ($condition($annotation)) { |
|
| 64 | 64 | $hooks[] = [ |
| 65 | 65 | 'hook' => $annotation->hook, |
| 66 | 66 | 'method' => $rmethod->getName(), |