pull/97/head
Override-6 2 years ago committed by sam
parent ec69adab44
commit cfa9b40bc1

@ -17,6 +17,7 @@ class API {
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *'); header('Access-Control-Allow-Headers: *');
foreach ($response->getHeaders() as $header => $value) { foreach ($response->getHeaders() as $header => $value) {
header("$header: $value"); header("$header: $value");
} }

@ -49,7 +49,6 @@ class APIAccountsController {
}); });
} }
/** /**
* @param int $userId * @param int $userId
* @return HttpResponse given user information. * @return HttpResponse given user information.

@ -25,6 +25,7 @@ class Control {
if (!$payload_obj instanceof \stdClass) { if (!$payload_obj instanceof \stdClass) {
$fail = new ValidationFail("bad-payload", "request body is not a valid json object"); $fail = new ValidationFail("bad-payload", "request body is not a valid json object");
return $errorFactory->apply([$fail]); return $errorFactory->apply([$fail]);
} }
$payload = get_object_vars($payload_obj); $payload = get_object_vars($payload_obj);
return self::runCheckedFrom($payload, $schema, $run, $errorFactory); return self::runCheckedFrom($payload, $schema, $run, $errorFactory);
@ -36,7 +37,6 @@ class Control {
* @param array<string, Validator[]> $schema an array of `fieldName => DefaultValidators` which represents the request object schema * @param array<string, Validator[]> $schema an array of `fieldName => DefaultValidators` which represents the request object schema
* @param callable(HttpRequest): HttpResponse $run the callback to run if the request is valid according to the given schema. * @param callable(HttpRequest): HttpResponse $run the callback to run if the request is valid according to the given schema.
* The callback must accept an HttpRequest, and return an HttpResponse object. * The callback must accept an HttpRequest, and return an HttpResponse object.
<<<<<<< HEAD:src/Core/Control.php
* @param ControlSchemaErrorResponseFactory $errorFactory an error factory to use if the request does not validate the required schema * @param ControlSchemaErrorResponseFactory $errorFactory an error factory to use if the request does not validate the required schema
* @return HttpResponse * @return HttpResponse
*/ */
@ -46,6 +46,7 @@ class Control {
if (!empty($fails)) { if (!empty($fails)) {
return $errorFactory->apply($fails); return $errorFactory->apply($fails);
} }
return call_user_func_array($run, [$request]); return call_user_func_array($run, [$request]);

Loading…
Cancel
Save