@@ -34,5 +34,5 @@ |
||
34 | 34 | * @param mixed ...$args |
35 | 35 | * @return void |
36 | 36 | */ |
37 | - public function execute( ...$args): void; |
|
37 | + public function execute(...$args): void; |
|
38 | 38 | } |
@@ -66,22 +66,22 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | * @throws InvalidArgumentException |
68 | 68 | */ |
69 | - public function register( Hook_Loader $loader ): void { |
|
69 | + public function register(Hook_Loader $loader): void { |
|
70 | 70 | |
71 | - if ( ! is_string( $this->hook ) || empty( $this->hook ) ) { |
|
72 | - throw new InvalidArgumentException( \sprintf( 'Hook not defined in %s subscriber', static::class ) ); |
|
71 | + if ( ! is_string($this->hook) || empty($this->hook)) { |
|
72 | + throw new InvalidArgumentException(\sprintf('Hook not defined in %s subscriber', static::class)); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // If we have a differed event. |
76 | - if ( ! empty( $this->deferred_hook ) ) { |
|
76 | + if ( ! empty($this->deferred_hook)) { |
|
77 | 77 | $loader->action( |
78 | 78 | $this->deferred_hook, |
79 | - function( ...$args ) { // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterface |
|
79 | + function(...$args) { // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterface |
|
80 | 80 | |
81 | 81 | // Create a new isntance using DI and register using the defined hook. |
82 | - $instance = App::make( static::class ); |
|
83 | - if ( is_callable( array( $instance, 'execute' ) ) ) { // Ensure valid callable |
|
84 | - \add_action( (string) $this->hook, array( $instance, 'execute' ), $this->priority, $this->args ); |
|
82 | + $instance = App::make(static::class); |
|
83 | + if (is_callable(array($instance, 'execute'))) { // Ensure valid callable |
|
84 | + \add_action((string) $this->hook, array($instance, 'execute'), $this->priority, $this->args); |
|
85 | 85 | } |
86 | 86 | }, |
87 | 87 | $this->priority, |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } else { |
91 | 91 | $loader->action( |
92 | 92 | $this->hook, |
93 | - array( $this, 'execute' ), |
|
93 | + array($this, 'execute'), |
|
94 | 94 | $this->priority, |
95 | 95 | $this->args |
96 | 96 | ); |
@@ -103,5 +103,5 @@ discard block |
||
103 | 103 | * @param mixed ...$args |
104 | 104 | * @return void |
105 | 105 | */ |
106 | - abstract public function execute( ...$args ): void; |
|
106 | + abstract public function execute(...$args): void; |
|
107 | 107 | } |