Commit 64621c69 authored by Erick Hitter's avatar Erick Hitter
Browse files

Review feedback: doesn't need a method to collect constants

parent 36c938ae
......@@ -19,6 +19,11 @@ class Events_Store extends Singleton {
const STATUS_PENDING = 'pending';
const STATUS_RUNNING = 'running';
const STATUS_COMPLETED = 'complete';
const ALLOWED_STATUSES = array(
self::STATUS_PENDING,
self::STATUS_RUNNING,
self::STATUS_COMPLETED,
);
const CACHE_KEY = 'a8c_cron_ctrl_option';
......@@ -48,17 +53,6 @@ class Events_Store extends Singleton {
return $wpdb->prefix . self::TABLE_SUFFIX;
}
/**
* Build array of valid event statuses
*/
public function get_allowed_statuses() {
return array(
self::STATUS_PENDING,
self::STATUS_RUNNING,
self::STATUS_COMPLETED,
);
}
/**
* Create the plugin's DB table when necessary
*/
......@@ -294,7 +288,7 @@ class Events_Store extends Singleton {
}
// Validate requested status
$allowed_status = $this->get_allowed_statuses();
$allowed_status = self::ALLOWED_STATUSES;
$allowed_status[] = 'any';
if ( ! isset( $attrs['status'] ) || ! in_array( $attrs['status'], $allowed_status, true ) ) {
......@@ -589,7 +583,7 @@ class Events_Store extends Singleton {
public function count_events_by_status( $status ) {
global $wpdb;
if ( ! in_array( $status, $this->get_allowed_statuses(), true ) ) {
if ( ! in_array( $status, self::ALLOWED_STATUSES, true ) ) {
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment