$value) { header(sprintf('%s: %s', $name, $value)); } /** @var mixed $id */ $id = $request->getParsedBodyParam('id'); $vids = explode(',', is_string($id) ? $id : ''); /** @var mixed $valuesParam */ $valuesParam = $request->getParsedBodyParam('values'); $values = json_decode(is_string($valuesParam) ? $valuesParam : ''); if (! ($values instanceof stdClass)) { echo json_encode(['success' => false, 'message' => __('Wrong data')]); return; } $values = (array) $values; $result = Validator::validate($GLOBALS['ConfigFile'], $vids, $values, true); if ($result === false) { $result = sprintf( __('Wrong data or no validation for %s'), implode(',', $vids), ); } echo $result !== true ? json_encode($result) : ''; } }