<?php
class Validator {
    public static function requireFields($data, $fields) {
        foreach ($fields as $field) {
            if (!isset($data[$field]) || trim($data[$field]) === '') {
                Response::error("Missing required field: $field", 400);
            }
        }
    }
}
