Skip to content

Commit

Permalink
Replace filter call with find call. #1 (#2) (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstandiford authored Jun 22, 2021
1 parent 875551e commit afe8c11
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/abstracts/Event_Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function __get( $key ) {
if ( isset( $this->$key ) ) {
return $this->$key;
} else {
return new WP_error( 'logger_param_not_set', 'The logger param ' . $key . ' could not be found.' );
return new WP_Error( 'logger_param_not_set', 'The logger param ' . $key . ' could not be found.' );
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/abstracts/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __get( $key ) {
if ( isset( $this->$key ) ) {
return $this->$key;
} else {
return new WP_error( 'batch_task_param_not_set', 'The batch task key ' . $key . ' could not be found.' );
return new WP_Error( 'batch_task_param_not_set', 'The batch task key ' . $key . ' could not be found.' );
}
}
}
6 changes: 3 additions & 3 deletions lib/abstracts/registries/Event_Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,17 @@ public function get( $key ) {

// If the logged event could not be found, search event type keys.
if ( is_wp_error( $result ) ) {
$event_types = $this->filter( [
$event_type = $this->find( [
'type' => $key,
] );

// If that also comes up empty, return the error.
if ( empty( $event_types ) ) {
if ( is_wp_error( $event_type ) ) {
return $result;
}

// Return the discovered event.
$result = $event_types[0];
$result = $event_type;
}

return $result;
Expand Down

0 comments on commit afe8c11

Please sign in to comment.