$ts, 'gateway' => isset($entry['gateway']) ? (string) $entry['gateway'] : '', 'type' => isset($entry['type']) ? (string) $entry['type'] : '', 'event_id' => isset($entry['event_id']) ? (string) $entry['event_id'] : '', 'order_id' => isset($entry['order_id']) ? (int) $entry['order_id'] : 0, 'message' => isset($entry['message']) ? (string) $entry['message'] : '', ]; array_unshift($rows, $new); $rows = array_slice($rows, 0, self::MAX_ENTRIES); update_option(self::OPTION, $rows, false); } public static function all(int $limit = 200): array { $rows = get_option(self::OPTION, []); if (!is_array($rows)) { return []; } $limit = max(1, min(self::MAX_ENTRIES, (int) $limit)); return array_slice($rows, 0, $limit); } public static function clear(): void { delete_option(self::OPTION); } }