$analysis['analyzed_at'], 'summary' => $analysis['summary'] ); $last = end( $history ); if ( is_array( $last ) && is_array( $last['summary'] ?? null ) && $last['summary'] === $entry['summary'] ) { $history[ count( $history ) - 1 ] = $entry; } else { $history[] = $entry; } update_option( self::HISTORY_OPTION, array_slice( $history, -self::HISTORY_LIMIT ), false ); } public function getHistory(): array { $history = get_option( self::HISTORY_OPTION, array() ); return is_array( $history ) ? $history : array(); } }