Skip to content

Commit

Permalink
update: proper doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mralaminahamed committed Dec 24, 2024
1 parent d30e215 commit 351819f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 52 deletions.
82 changes: 41 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions includes/ProductStatusRollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function process_reject_operation(): void {
self::BATCH_SIZE,
)
);

if ( empty( $products ) ) {
return;
}
Expand All @@ -77,8 +78,8 @@ public function process_reject_operation(): void {
*
* @since DOKAN_PRO_SINCE
*
* @param string $target_status Target status
* @param WC_Product $product Product object
* @param string $target_status Target rollback status
* @param WC_Product $product Product
*/
$target_status = apply_filters( 'dokan_product_rollback_status', 'draft', $product );

Expand All @@ -87,15 +88,13 @@ public function process_reject_operation(): void {
*
* @since DOKAN_PRO_SINCE
*
* @param WC_Product $product Product object
* @param string $target_status Target status
* @param WC_Product $product Product
* @param string $target_status Target rollback status
*/
do_action( 'dokan_before_product_rollback', $product, $target_status );

// Track previous status
$product->add_meta_data( '_dokan_previous_status', $product->get_status(), true );
$product->save_meta_data();

$product->add_meta_data( '_dokan_previous_status', $product->get_status() );
$product->set_status( $target_status );
$product->save();

Expand All @@ -104,12 +103,12 @@ public function process_reject_operation(): void {
*
* @since DOKAN_PRO_SINCE
*
* @param WC_Product $product Product object
* @param string $target_status Target status
* @param WC_Product $product Product
* @param string $target_status Target rollback status
*/
do_action( 'dokan_after_product_status_rollback', $product, $target_status );

++$processed;
++ $processed;

Check failure on line 111 in includes/ProductStatusRollback.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected no spaces between the increment operator and $processed; 1 found
} catch ( Throwable $e ) {
dokan_log(
sprintf(
Expand All @@ -124,7 +123,7 @@ public function process_reject_operation(): void {

dokan_log( sprintf( 'Processed reject->draft : %d products', $processed ) );

// Register next schedule if needed
// Schedule next batch
WC()->queue()->add( 'dokan_rollback_product_status_reject_to_draft_schedule', array(), self::QUEUE_GROUP );
} catch ( Throwable $e ) {
dokan_log(
Expand Down

0 comments on commit 351819f

Please sign in to comment.