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

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

03 Jul 2026 08:55AM UTC coverage: 17.482% (-1.3%) from 18.764%
28649814905

push

github

wol-soft
Merge remote-tracking branch 'origin/master' into jsonSchemaDraft2019

# Conflicts:
#	src/Exception/Arrays/MaxItemsException.php
#	src/Exception/Arrays/MinItemsException.php
#	src/Exception/Object/MaxPropertiesException.php
#	src/Exception/Object/MinPropertiesException.php

3 of 101 new or added lines in 37 files covered. (2.97%)

47 existing lines in 27 files now uncovered.

168 of 961 relevant lines covered (17.48%)

0.58 hits per line

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

0.0
/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(
×
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

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

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

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

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

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

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

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

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