← All changes
|
classes/async-operation/queries/operation-query.php
+12
-1
1.5.1
→
1.7.7
View file →
| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace ImageOptimization\Classes\Async_Operation\Queries; |
| 4 | 4 | |
| 5 | 5 | use ImageOptimization\Classes\Async_Operation\Async_Operation_Hook; |
| 6 | +use ImageOptimization\Classes\Async_Operation\Async_Operation_Queue; | |
| 6 | 7 | use ImageOptimization\Classes\Async_Operation\Interfaces\Operation_Query_Interface; |
| 7 | 8 | use TypeError; |
| 8 | 9 | |
| 9 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -14,12 +15,22 @@ | ||
| 14 | 15 | private array $query; |
| 15 | 16 | |
| 16 | 17 | public function set_hook( string $hook ): self { |
| 17 | 18 | if ( ! in_array( $hook, Async_Operation_Hook::get_values(), true ) ) { |
| 18 | - throw new TypeError( "Hook $hook is not a part of Async_Operation_Hook values" ); | |
| 19 | + throw new TypeError( esc_html( "Hook $hook is not a part of Async_Operation_Hook values" ) ); | |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | $this->query['hook'] = $hook; |
| 23 | + | |
| 24 | + return $this; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public function set_queue( string $queue ): self { | |
| 28 | + if ( ! in_array( $queue, Async_Operation_Queue::get_values(), true ) ) { | |
| 29 | + throw new TypeError( esc_html( "Queue $queue is not a part of Async_Operation_Queue values" ) ); | |
| 30 | + } | |
| 31 | + | |
| 32 | + $this->query['group'] = $queue; | |
| 22 | 33 | |
| 23 | 34 | return $this; |
| 24 | 35 | } |
| 25 | 36 | |