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

wol-soft / php-json-schema-model-generator / 14452675932

14 Apr 2025 06:12PM UTC coverage: 98.564%. Remained the same
14452675932

Pull #91

github

web-flow
Merge 2ab2e1fc0 into 61f224022
Pull Request #91: Execute tests when we need no coverage

3295 of 3343 relevant lines covered (98.56%)

569.28 hits per line

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

95.24
/src/PropertyProcessor/Property/ReferenceProcessor.php
1
<?php
2

3
declare(strict_types = 1);
4

5
namespace PHPModelGenerator\PropertyProcessor\Property;
6

7
use Exception;
8
use PHPModelGenerator\Exception\SchemaException;
9
use PHPModelGenerator\Model\Property\PropertyInterface;
10
use PHPModelGenerator\Model\SchemaDefinition\JsonSchema;
11
use PHPModelGenerator\PropertyProcessor\Decorator\SchemaNamespaceTransferDecorator;
12

13
/**
14
 * Class ReferenceProcessor
15
 *
16
 * @package PHPModelGenerator\PropertyProcessor\Property
17
 */
18
class ReferenceProcessor extends AbstractTypedValueProcessor
19
{
20
    /**
21
     * @inheritdoc
22
     *
23
     * @throws SchemaException
24
     */
25
    public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
524✔
26
    {
27
        $path = [];
524✔
28
        $reference = $propertySchema->getJson()['$ref'];
524✔
29
        $dictionary = $this->schema->getSchemaDictionary();
524✔
30

31
        try {
32
            $definition = $dictionary->getDefinition($reference, $this->schemaProcessor, $path);
524✔
33

34
            if ($definition) {
519✔
35
                if ($this->schema->getClassPath() !== $definition->getSchema()->getClassPath() ||
519✔
36
                    $this->schema->getClassName() !== $definition->getSchema()->getClassName() ||
519✔
37
                    (
38
                        $this->schema->getClassName() === 'ExternalSchema' &&
519✔
39
                        $definition->getSchema()->getClassName() === 'ExternalSchema'
519✔
40
                    )
41
                ) {
42
                    $this->schema->addNamespaceTransferDecorator(
240✔
43
                        new SchemaNamespaceTransferDecorator($definition->getSchema()),
240✔
44
                    );
240✔
45
                }
46

47
                return $definition->resolveReference($propertyName, $path, $this->propertyMetaDataCollection);
519✔
48
            }
49
        } catch (Exception $exception) {
6✔
50
            throw new SchemaException(
6✔
51
                "Unresolved Reference $reference in file {$propertySchema->getFile()}",
6✔
52
                0,
6✔
53
                $exception,
6✔
54
            );
6✔
55
        }
56

57
        throw new SchemaException("Unresolved Reference $reference in file {$propertySchema->getFile()}");
×
58
    }
59
}
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