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

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

75.86
/src/Exception/ComposedValue/ConditionalException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace PHPModelGenerator\Exception\ComposedValue;
6

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

11
/**
12
 * Class ConditionalException
13
 *
14
 * @package PHPModelGenerator\Exception\ComposedValue
15
 */
16
class ConditionalException extends ValidationException
17
{
18
    /**
19
     * ConditionalException constructor.
20
     *
21
     * @param $providedValue
22
     */
23
    public function __construct(
1✔
24
        $providedValue,
25
        string $propertyName,
26
        string $jsonPointer,
27
        private readonly ?Exception $ifException,
28
        private readonly ?Exception $thenException,
29
        private readonly ?Exception $elseException
30
    ) {
31

32
        parent::__construct($this->getErrorMessage($propertyName), $propertyName, $providedValue, $jsonPointer);
1✔
33
    }
34

NEW
35
    public function getIfException(): ?Exception
×
36
    {
NEW
37
        return $this->ifException;
×
38
    }
39

UNCOV
40
    public function getThenException(): ?Exception
×
41
    {
NEW
42
        return $this->thenException;
×
43
    }
44

NEW
45
    public function getElseException(): ?Exception
×
46
    {
NEW
47
        return $this->elseException;
×
48
    }
49

50
    private function getErrorMessage(string $propertyName): string
1✔
51
    {
52
        $message = "Invalid value for $propertyName declined by conditional composition constraint\n";
1✔
53

54
        $message .= $this->ifException
1✔
55
            ? "  - Condition: Failed" . $this->getExceptionMessage($this->ifException)
×
56
            : '  - Condition: Valid';
1✔
57

58
        return $message . "\n  - Conditional branch failed:" .
1✔
59
            $this->getExceptionMessage($this->thenException ?: $this->elseException);
1✔
60
    }
61

62
    private function getExceptionMessage(Exception $exception): string
1✔
63
    {
64
        return $exception instanceof ErrorRegistryExceptionInterface
1✔
65
            ? implode(
1✔
66
                "\n    * ",
1✔
67
                str_replace(
1✔
68
                    "\n",
1✔
69
                    "\n    ",
1✔
70
                    array_map(
1✔
71
                        fn(ValidationException $exception): string => $exception->getMessage(),
1✔
72
                        $exception->getErrors(),
1✔
73
                    ),
1✔
74
                ),
1✔
75
            )
1✔
76
            : "\n    * " . str_replace("\n", "\n    ", $exception->getMessage());
1✔
77
    }
78
}
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