Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPCS: classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php #1132

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public function run( $args, $assoc_args ) {

$batches_completed = 0;
$actions_completed = 0;
$unlimited = $batches === 0;
if ( is_callable( [ ActionScheduler::store(), 'set_claim_filter' ] ) ) {
$unlimited = 0 === $batches;
if ( is_callable( array( ActionScheduler::store(), 'set_claim_filter' ) ) ) {
$exclude_groups = $this->parse_comma_separated_string( $exclude_groups );

if ( ! empty( $exclude_groups ) ) {
ActionScheduler::store()->set_claim_filter('exclude-groups', $exclude_groups );
ActionScheduler::store()->set_claim_filter( 'exclude-groups', $exclude_groups );
}
}

Expand Down Expand Up @@ -141,8 +141,6 @@ private function parse_comma_separated_string( $string ): array {
/**
* Print WP CLI message about how many actions are about to be processed.
*
* @author Jeremy Pry
*
* @param int $total Number of actions found.
*/
protected function print_total_actions( $total ) {
Expand All @@ -158,8 +156,6 @@ protected function print_total_actions( $total ) {
/**
* Print WP CLI message about how many batches of actions were processed.
*
* @author Jeremy Pry
*
* @param int $batches_completed Number of completed batches.
*/
protected function print_total_batches( $batches_completed ) {
Expand All @@ -175,11 +171,9 @@ protected function print_total_batches( $batches_completed ) {
/**
* Convert an exception into a WP CLI error.
*
* @author Jeremy Pry
*
* @param Exception $e The error object.
*
* @throws \WP_CLI\ExitException
crstauf marked this conversation as resolved.
Show resolved Hide resolved
* @throws \WP_CLI\ExitException Under some conditions WP CLI may throw an exception.
*/
protected function print_error( Exception $e ) {
WP_CLI::error(
Expand All @@ -194,8 +188,6 @@ protected function print_error( Exception $e ) {
/**
* Print a success message with the number of completed actions.
*
* @author Jeremy Pry
*
* @param int $actions_completed Number of completed actions.
*/
protected function print_success( $actions_completed ) {
Expand Down
4 changes: 4 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
<exclude-pattern>classes/WP_CLI/ActionScheduler_WPCLI_Scheduler_command.php</exclude-pattern>
</rule>

<rule ref="PEAR.NamingConventions.ValidClassName">
<exclude-pattern>classes/data-stores/ActionScheduler_wpPostStore.php</exclude-pattern>
<exclude-pattern>classes/ActionScheduler_wcSystemStatus.php</exclude-pattern>
Expand Down
Loading