• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 10790047473

10 Sep 2024 09:50AM UTC coverage: 7.659% (-0.001%) from 7.66%
10790047473

push

github

web-flow
feat(laravel): parameter validator + security (#6603)

0 of 38 new or added lines in 4 files covered. (0.0%)

1192 existing lines in 74 files now uncovered.

12581 of 164273 relevant lines covered (7.66%)

22.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Laravel/State/ValidationErrorTrait.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Laravel\State;
15

16
use ApiPlatform\Laravel\ApiResource\ValidationError;
17
use Illuminate\Contracts\Validation\Validator;
18
use Illuminate\Validation\ValidationException;
19

20
trait ValidationErrorTrait
21
{
22
    private function getValidationError(Validator $validator, ValidationException $e): ValidationError
23
    {
NEW
24
        $errors = $validator->errors();
×
NEW
25
        $violations = [];
×
NEW
26
        $id = hash('xxh3', implode(',', $errors->keys()));
×
NEW
27
        foreach ($errors->messages() as $prop => $message) {
×
NEW
28
            $violations[] = ['propertyPath' => $prop, 'message' => implode(\PHP_EOL, $message)];
×
29
        }
30

NEW
31
        return new ValidationError($e->getMessage(), $id, $e, $violations);
×
32
    }
33
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc