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

wol-soft / php-json-schema-model-generator-production / 17862408584

19 Sep 2025 03:15PM UTC coverage: 18.962% (+5.0%) from 13.926%
17862408584

push

github

web-flow
Merge pull request #12 from wol-soft/BuilderClassPostProcessor

BuilderInterface

3 of 3 new or added lines in 1 file covered. (100.0%)

99 existing lines in 36 files now uncovered.

106 of 559 relevant lines covered (18.96%)

0.55 hits per line

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

0.0
/src/Exception/Object/InvalidAdditionalPropertiesException.php
1
<?php
2

3
declare(strict_types = 1);
4

5
namespace PHPModelGenerator\Exception\Object;
6

7
use PHPModelGenerator\Exception\ValidationException;
8

9
/**
10
 * Class InvalidAdditionalPropertiesException
11
 *
12
 * @package PHPModelGenerator\Exception\Object
13
 */
14
class InvalidAdditionalPropertiesException extends ValidationException
15
{
16
    protected const MAIN_MESSAGE = 'Provided JSON for %s contains invalid additional properties.';
17
    protected const TYPE = 'additional property';
18

19
    /** @var ValidationException[][] */
20
    protected $nestedExceptions;
21

22
    /**
23
     * InvalidAdditionalPropertiesException constructor.
24
     *
25
     * @param $providedValue
26
     * @param string $propertyName
27
     * @param ValidationException[][] $nestedExceptions
28
     */
UNCOV
29
    public function __construct($providedValue, string $propertyName, $nestedExceptions)
×
30
    {
31
        $this->nestedExceptions = $nestedExceptions;
×
32

33
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue);
×
34
    }
35

36
    /**
37
     * Get a list of nested exceptions containing all failed validations indexed by the property name
38
     *
39
     * @return ValidationException[][]
40
     */
UNCOV
41
    public function getNestedExceptions(): array
×
42
    {
43
        return $this->nestedExceptions;
×
44
    }
45

UNCOV
46
    protected function getErrorMessage(string $propertyName): string
×
47
    {
48
        $output = '';
×
49
        foreach ($this->nestedExceptions as $nestedPropertyName => $exceptions) {
×
50
            $output .= sprintf(
×
51
                "\n  - invalid %s '%s'\n    * %s",
×
52
                static::TYPE,
×
53
                $nestedPropertyName,
×
54
                implode(
×
55
                    "\n    * ",
×
56
                    str_replace(
×
57
                        "\n",
×
58
                        "\n    ",
×
UNCOV
59
                        array_map(function (ValidationException $exception): string {
×
60
                            return $exception->getMessage();
×
61
                        }, $exceptions)
×
62
                    )
×
63
                )
×
64
            );
×
65
        }
66

67
        return sprintf(static::MAIN_MESSAGE, $propertyName) . $output;
×
68
    }
69
}
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

© 2025 Coveralls, Inc