• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
You are now the owner of this repo.

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

16 Jul 2026 01:02AM UTC coverage: 28.499% (+7.0%) from 21.548%
29463085398

Pull #19

github

web-flow
Merge d8127da4e into c0ae531ee
Pull Request #19: Re-indent nested composition/conditional messages under their own bullet

15 of 85 new or added lines in 38 files covered. (17.65%)

81 existing lines in 17 files now uncovered.

224 of 786 relevant lines covered (28.5%)

0.86 hits per line

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

87.5
/src/Exception/ComposedValue/InvalidComposedValueException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace PHPModelGenerator\Exception\ComposedValue;
6

7
use PHPModelGenerator\Exception\ErrorRegistryExceptionInterface;
8
use PHPModelGenerator\Exception\ValidationException;
9

10
/**
11
 * Class InvalidComposedValueException
12
 *
13
 * @package PHPModelGenerator\Exception\ComposedValue
14
 */
15
abstract class InvalidComposedValueException extends ValidationException
16
{
17
    protected const COMPOSED_ERROR_MESSAGE = '';
18
    /**
19
     * InvalidComposedValueException constructor.
20
     *
21
     * @param $providedValue
22
     * @param ValidationException[][] $compositionErrorCollection
23
     */
24
    public function __construct(
2✔
25
        $providedValue,
26
        string $propertyName,
27
        string $jsonPointer,
28
        protected int $succeededCompositionElements,
29
        protected array $compositionErrorCollection
30
    ) {
31
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue, $jsonPointer);
2✔
32
    }
33

NEW
34
    public function getSucceededCompositionElements(): int
×
35
    {
NEW
36
        return $this->succeededCompositionElements;
×
37
    }
38

39
    /**
40
     * @return ValidationException[][]
41
     */
UNCOV
42
    public function getCompositionErrorCollection(): array
×
43
    {
44
        return $this->compositionErrorCollection;
×
45
    }
46

47
    protected function getErrorMessage(string $propertyName): string
2✔
48
    {
49
        $compositionIndex = 0;
2✔
50

51
        return "Invalid value for $propertyName declined by composition constraint.\n  " .
2✔
52
            sprintf(static::COMPOSED_ERROR_MESSAGE, $this->succeededCompositionElements) .
2✔
53
            array_reduce(
2✔
54
                $this->compositionErrorCollection,
2✔
55
                function (string $carry, ErrorRegistryExceptionInterface $exception) use (&$compositionIndex): string {
2✔
56
                    return "$carry\n  - Composition element #" . ++$compositionIndex . (
2✔
57
                        $exception->getErrors()
2✔
58
                            ? ": Failed\n    * " .
2✔
59
                                implode(
2✔
60
                                    "\n    * ",
2✔
61
                                    str_replace(
2✔
62
                                        "\n",
2✔
63
                                        "\n    ",
2✔
64
                                        array_map(
2✔
65
                                            fn(ValidationException $exception): string => $exception->getMessage(),
2✔
66
                                            $exception->getErrors(),
2✔
67
                                        )
2✔
68
                                    )
2✔
69
                                )
2✔
70
                            : ': Valid'
2✔
71
                        );
2✔
72
                },
2✔
73
                ''
2✔
74
            );
2✔
75
    }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc