Skip to content

Commit

Permalink
🤖 PHPCBF
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHenryIE authored and github-actions[bot] committed Nov 18, 2024
1 parent 23d10ed commit 585aeca
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 83 deletions.
2 changes: 0 additions & 2 deletions includes/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,5 @@ public function __construct( $category = 'Admin', $key = '', $data = array() ) {
'role' => ( ! empty( $user->roles[0] ) ) ? $user->roles[0] : '',
'locale' => get_user_locale(),
);

}

}
7 changes: 3 additions & 4 deletions includes/EventQueue/EventQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ public static function getInstance() {
/**
* Constructor
*
* @param Container $container
* @param Container $container
*/
private function __construct() {

global $wpdb;

$container = new Container(
[
array(
'table' => "{$wpdb->prefix}nfd_data_event_queue",
]
)
);

$container->set(
Expand Down Expand Up @@ -86,5 +86,4 @@ public function container() {
public function queue() {
return $this->container->get( 'queue' );
}

}
5 changes: 2 additions & 3 deletions includes/EventQueue/Queryable.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ protected function table() {
* Bulk inserts records into a table using WPDB. All rows must contain the same keys.
* Returns number of affected (inserted) rows.
*
* @param string $table
* @param non-empty-array $rows
* @param string $table
* @param non-empty-array $rows
*
* @return bool|int
*/
Expand Down Expand Up @@ -63,5 +63,4 @@ protected function bulkInsert( string $table, array $rows ) {
// Run the query. Returns number of affected rows.
return $wpdb->query( $wpdb->prepare( $sql, $data ) );
}

}
22 changes: 11 additions & 11 deletions includes/EventQueue/Queues/BatchQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BatchQueue implements BatchQueueInterface {
/**
* Constructor
*
* @param Container $container
* @param Container $container
*/
public function __construct( Container $container ) {
$this->container = $container;
Expand All @@ -29,21 +29,21 @@ public function __construct( Container $container ) {
/**
* Push events onto the queue
*
* @param non-empty-array<Event> $events
* @param non-empty-array<Event> $events
*
* @return bool
*/
public function push( array $events ) {

$time = current_time( 'mysql' );

$inserts = [];
$inserts = array();
foreach ( $events as $event ) {
$inserts[] = [
$inserts[] = array(
'event' => serialize( $event ),
'available_at' => current_time( 'mysql' ),
'created_at' => $time,
];
);
}

return (bool) $this->bulkInsert( $this->table(), $inserts );
Expand All @@ -56,7 +56,7 @@ public function push( array $events ) {
*/
public function pull( int $count ) {

$events = [];
$events = array();

$rawEvents = $this
->query()
Expand Down Expand Up @@ -84,7 +84,7 @@ public function pull( int $count ) {
/**
* Remove events from the queue
*
* @param int[] $ids
* @param int[] $ids
*
* @return bool
*/
Expand All @@ -99,7 +99,7 @@ public function remove( array $ids ) {
/**
* Reserve events in the queue
*
* @param int[] $ids
* @param int[] $ids
*
* @return bool
*/
Expand All @@ -108,13 +108,13 @@ public function reserve( array $ids ) {
->query()
->table( $this->table(), false )
->whereIn( 'id', $ids )
->update( [ 'reserved_at' => current_time( 'mysql' ) ] );
->update( array( 'reserved_at' => current_time( 'mysql' ) ) );
}

/**
* Release events back onto the queue
*
* @param int[] $ids
* @param int[] $ids
*
* @return bool
*/
Expand All @@ -123,7 +123,7 @@ public function release( array $ids ) {
->query()
->table( $this->table(), false )
->whereIn( 'id', $ids )
->update( [ 'reserved_at' => null ] );
->update( array( 'reserved_at' => null ) );
}

/**
Expand Down
9 changes: 4 additions & 5 deletions includes/EventQueue/Queues/BatchQueueInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface BatchQueueInterface {
/**
* Push one or more events onto the queue
*
* @param Event[] $events
* @param Event[] $events
*
* @return bool
*/
Expand All @@ -25,7 +25,7 @@ public function pull( int $count );
/**
* Remove one or more events from the queue
*
* @param Event[] $events
* @param Event[] $events
*
* @return bool
*/
Expand All @@ -34,7 +34,7 @@ public function remove( array $events );
/**
* Reserve one or more events in the queue
*
* @param Event[] $events
* @param Event[] $events
*
* @return bool
*/
Expand All @@ -43,7 +43,7 @@ public function reserve( array $events );
/**
* Release one or more events back onto the queue
*
* @param Event[] $events
* @param Event[] $events
*
* @return bool
*/
Expand All @@ -55,5 +55,4 @@ public function release( array $events );
* @return int
*/
public function count();

}
3 changes: 1 addition & 2 deletions includes/Helpers/SiteHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static function calculate_score( $results ) {

$total_tests = array_reduce(
$results,
function( $total, $item ) {
function ( $total, $item ) {
return $total += (int) $item;
}
);
Expand All @@ -134,5 +134,4 @@ function( $total, $item ) {

return round( (int) $results['good'] / $total_tests * 100 );
}

}
8 changes: 4 additions & 4 deletions includes/Listeners/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function register_hooks() {
/**
* Post status transition
*
* @param string $new_status The new post status
* @param string $old_status The old post status
* @param string $new_status The new post status
* @param string $old_status The old post status
* @param \WP_Post $post Post object
*
* @return void
Expand Down Expand Up @@ -94,8 +94,8 @@ public function count_posts() {
/**
* Comment status transition
*
* @param string $new_status The new comment status
* @param string $old_status The new comment status
* @param string $new_status The new comment status
* @param string $old_status The new comment status
* @param WP_Comment $comment Comment object
*
* @return void
Expand Down
1 change: 0 additions & 1 deletion includes/Listeners/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,4 @@ protected function get_class_name() {

return substr( $class, $position + 1 );
}

}
4 changes: 2 additions & 2 deletions includes/Listeners/SiteHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public function tests_run( $value ) {
$this->push(
'site_health_score',
array(
'label_key' => 'score',
'score' => SiteHealthHelper::calculate_score( $value ),
'label_key' => 'score',
'score' => SiteHealthHelper::calculate_score( $value ),
)
);
$this->push(
Expand Down
16 changes: 14 additions & 2 deletions includes/Listeners/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ public function theme_changed( $new_option, $old_option ) {
public function mojo_preview() {
global $theme;
if ( isset( $_GET['page'] ) && 'mojo-theme-preview' === $_GET['page'] && ! is_wp_error( $theme ) ) {
$this->push( 'mojo_theme_preview', array( 'label_key' => 'theme', 'theme' => $theme ) );
$this->push(
'mojo_theme_preview',
array(
'label_key' => 'theme',
'theme' => $theme,
)
);
}
}

Expand All @@ -65,6 +71,12 @@ public function mojo_preview() {
*/
public function browse_wporg_themes() {
$category = ( isset( $_GET['browse'] ) ) ? esc_attr( $_GET['browse'] ) : 'featured';
$this->push( 'browse_wporg_themes', array( 'label_key' => 'category', 'category' => $category ) );
$this->push(
'browse_wporg_themes',
array(
'label_key' => 'category',
'category' => $category,
)
);
}
}
6 changes: 3 additions & 3 deletions includes/Listeners/WonderCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function create_campaign_modal_open( $args, $event ) {
public function campaign_selected( $args, $event ) {
$data = array(
'label_key' => 'campaign_slug',
'type' => $args['type'],
'type' => $args['type'],
'campaign_slug' => $args['type'],
);

Expand All @@ -105,7 +105,7 @@ public function campaign_selected( $args, $event ) {
public function campaign_abandoned( $args, $event ) {
$data = array(
'label_key' => 'campaign_slug',
'type' => $args['type'],
'type' => $args['type'],
'campaign_slug' => $args['type'] . '-' . $args['id'],
);

Expand Down Expand Up @@ -155,7 +155,7 @@ public function checkout_campaigns_used() {
if ( count( $campaigns ) > 0 ) {
$data = array(
'label_key' => 'type',
'type' => array_unique( $campaigns ),
'type' => array_unique( $campaigns ),
'campaign_count' => count( $campaigns ),
'campaign_total' => '$' . $campaign_total,
);
Expand Down
Loading

0 comments on commit 585aeca

Please sign in to comment.