← All changes
|
vendor/woocommerce/action-scheduler/classes/migration/BatchFetcher.php
+28
-19
1.0.2
→
trunk
View file →
| @@ -1,10 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - | |
| 4 | 3 | namespace Action_Scheduler\Migration; |
| 5 | 4 | |
| 6 | - | |
| 7 | 5 | use ActionScheduler_Store as Store; |
| 8 | 6 | |
| 9 | 7 | /** |
| 10 | 8 | * Class BatchFetcher |
| @@ -15,9 +13,13 @@ | ||
| 15 | 13 | * |
| 16 | 14 | * @codeCoverageIgnore |
| 17 | 15 | */ |
| 18 | 16 | class BatchFetcher { |
| 19 | - /** var ActionScheduler_Store */ | |
| 17 | + /** | |
| 18 | + * Store instance. | |
| 19 | + * | |
| 20 | + * @var ActionScheduler_Store | |
| 21 | + */ | |
| 20 | 22 | private $store; |
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | 25 | * BatchFetcher constructor. |
| @@ -30,9 +32,9 @@ | ||
| 30 | 32 | |
| 31 | 33 | /** |
| 32 | 34 | * Retrieve a list of actions. |
| 33 | 35 | * |
| 34 | - * @param int $count The number of actions to retrieve | |
| 36 | + * @param int $count The number of actions to retrieve. | |
| 35 | 37 | * |
| 36 | 38 | * @return int[] A list of action IDs |
| 37 | 39 | */ |
| 38 | 40 | public function fetch( $count = 10 ) { |
| @@ -42,9 +44,9 @@ | ||
| 42 | 44 | return $action_ids; |
| 43 | 45 | } |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | - return []; | |
| 48 | + return array(); | |
| 47 | 49 | } |
| 48 | 50 | |
| 49 | 51 | /** |
| 50 | 52 | * Generate a list of prioritized of action search parameters. |
| @@ -54,33 +56,40 @@ | ||
| 54 | 56 | * @return array |
| 55 | 57 | */ |
| 56 | 58 | private function get_query_strategies( $count ) { |
| 57 | 59 | $now = as_get_datetime_object(); |
| 58 | - $args = [ | |
| 60 | + $args = array( | |
| 59 | 61 | 'date' => $now, |
| 60 | 62 | 'per_page' => $count, |
| 61 | 63 | 'offset' => 0, |
| 62 | 64 | 'orderby' => 'date', |
| 63 | 65 | 'order' => 'ASC', |
| 64 | - ]; | |
| 66 | + ); | |
| 65 | 67 | |
| 66 | - $priorities = [ | |
| 68 | + $priorities = array( | |
| 67 | 69 | Store::STATUS_PENDING, |
| 68 | 70 | Store::STATUS_FAILED, |
| 69 | 71 | Store::STATUS_CANCELED, |
| 70 | 72 | Store::STATUS_COMPLETE, |
| 71 | 73 | Store::STATUS_RUNNING, |
| 72 | - '', // any other unanticipated status | |
| 73 | - ]; | |
| 74 | + '', // any other unanticipated status. | |
| 75 | + ); | |
| 74 | 76 | |
| 75 | 77 | foreach ( $priorities as $status ) { |
| 76 | - yield wp_parse_args( [ | |
| 77 | - 'status' => $status, | |
| 78 | - 'date_compare' => '<=', | |
| 79 | - ], $args ); | |
| 80 | - yield wp_parse_args( [ | |
| 81 | - 'status' => $status, | |
| 82 | - 'date_compare' => '>=', | |
| 83 | - ], $args ); | |
| 78 | + yield wp_parse_args( | |
| 79 | + array( | |
| 80 | + 'status' => $status, | |
| 81 | + 'date_compare' => '<=', | |
| 82 | + ), | |
| 83 | + $args | |
| 84 | + ); | |
| 85 | + | |
| 86 | + yield wp_parse_args( | |
| 87 | + array( | |
| 88 | + 'status' => $status, | |
| 89 | + 'date_compare' => '>=', | |
| 90 | + ), | |
| 91 | + $args | |
| 92 | + ); | |
| 84 | 93 | } |
| 85 | 94 | } |
| 86 | -} | |
| 95 | +} | |