Skip to content

Commit afe8c11

Browse files
Replace filter call with find call. #1 (#2) (#3)
1 parent 875551e commit afe8c11

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/abstracts/Event_Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function __get( $key ) {
331331
if ( isset( $this->$key ) ) {
332332
return $this->$key;
333333
} else {
334-
return new WP_error( 'logger_param_not_set', 'The logger param ' . $key . ' could not be found.' );
334+
return new WP_Error( 'logger_param_not_set', 'The logger param ' . $key . ' could not be found.' );
335335
}
336336
}
337337

lib/abstracts/Writer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function __get( $key ) {
9090
if ( isset( $this->$key ) ) {
9191
return $this->$key;
9292
} else {
93-
return new WP_error( 'batch_task_param_not_set', 'The batch task key ' . $key . ' could not be found.' );
93+
return new WP_Error( 'batch_task_param_not_set', 'The batch task key ' . $key . ' could not be found.' );
9494
}
9595
}
9696
}

lib/abstracts/registries/Event_Registry.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,17 @@ public function get( $key ) {
232232

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

239239
// If that also comes up empty, return the error.
240-
if ( empty( $event_types ) ) {
240+
if ( is_wp_error( $event_type ) ) {
241241
return $result;
242242
}
243243

244244
// Return the discovered event.
245-
$result = $event_types[0];
245+
$result = $event_type;
246246
}
247247

248248
return $result;

0 commit comments

Comments
 (0)