diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2022-11-15 13:20:16 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2022-11-18 11:55:56 +0000 |
| commit | 748dbe155a6d19d66918ad136947fa23ee8f8469 (patch) | |
| tree | ed4743592d3b0aea968f9cbae7e5d32c00b546fe /app/Http/RequestHandlers/CreateSourceAction.php | |
| parent | f783aa1f4cd6d54a90d24a3d6be2996a3951fced (diff) | |
| download | webtrees-748dbe155a6d19d66918ad136947fa23ee8f8469.tar.gz webtrees-748dbe155a6d19d66918ad136947fa23ee8f8469.tar.bz2 webtrees-748dbe155a6d19d66918ad136947fa23ee8f8469.zip | |
Use Validator
Diffstat (limited to 'app/Http/RequestHandlers/CreateSourceAction.php')
| -rw-r--r-- | app/Http/RequestHandlers/CreateSourceAction.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/app/Http/RequestHandlers/CreateSourceAction.php b/app/Http/RequestHandlers/CreateSourceAction.php index 022774a716..34e88a65ad 100644 --- a/app/Http/RequestHandlers/CreateSourceAction.php +++ b/app/Http/RequestHandlers/CreateSourceAction.php @@ -40,17 +40,15 @@ class CreateSourceAction implements RequestHandlerInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { - $tree = Validator::attributes($request)->tree(); - - $params = (array) $request->getParsedBody(); - $title = $params['source-title']; - $abbreviation = $params['source-abbreviation']; - $author = $params['source-author']; - $publication = $params['source-publication']; - $repository = $params['source-repository']; - $call_number = $params['source-call-number']; - $text = $params['source-text']; - $restriction = $params['restriction']; + $tree = Validator::attributes($request)->tree(); + $title = Validator::parsedBody($request)->string('source-title'); + $abbreviation = Validator::parsedBody($request)->string('source-abbreviation'); + $author = Validator::parsedBody($request)->string('source-author'); + $publication = Validator::parsedBody($request)->string('source-publication'); + $repository = Validator::parsedBody($request)->string('source-repository'); + $call_number = Validator::parsedBody($request)->string('source-call-number'); + $text = Validator::parsedBody($request)->string('source-text'); + $restriction = Validator::parsedBody($request)->string('restriction'); // Fix non-printing characters $title = trim(preg_replace('/\s+/', ' ', $title)); |
