<?php

namespace App\Core;

final class Validator
{
    public static function require(array $data, array $fields): array
    {
        $errors = [];
        foreach ($fields as $field) {
            if (!isset($data[$field]) || $data[$field] === '') {
                $errors[$field] = 'Campo obligatorio';
            }
        }

        return $errors;
    }
}
