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

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

11 Sep 2025 04:52PM UTC coverage: 96.804% (-1.8%) from 98.564%
17651542034

Pull #92

github

wol-soft
BuilderClassPostProcessor draft
Pull Request #92: BuilderClassPostProcessor

70 of 133 new or added lines in 8 files covered. (52.63%)

4 existing lines in 1 file now uncovered.

3332 of 3442 relevant lines covered (96.8%)

563.81 hits per line

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

96.3
/src/PropertyProcessor/Property/AbstractValueProcessor.php
1
<?php
2

3
declare(strict_types = 1);
4

5
namespace PHPModelGenerator\PropertyProcessor\Property;
6

7
use PHPModelGenerator\Exception\SchemaException;
8
use PHPModelGenerator\Model\Property\Property;
9
use PHPModelGenerator\Model\Property\PropertyInterface;
10
use PHPModelGenerator\Model\Property\PropertyType;
11
use PHPModelGenerator\Model\Schema;
12
use PHPModelGenerator\Model\SchemaDefinition\JsonSchema;
13
use PHPModelGenerator\PropertyProcessor\Filter\FilterProcessor;
14
use PHPModelGenerator\PropertyProcessor\PropertyMetaDataCollection;
15
use PHPModelGenerator\SchemaProcessor\SchemaProcessor;
16
use ReflectionException;
17

18
/**
19
 * Class AbstractScalarValueProcessor
20
 *
21
 * @package PHPModelGenerator\PropertyProcessor\Property
22
 */
23
abstract class AbstractValueProcessor extends AbstractPropertyProcessor
24
{
25
    /**
26
     * AbstractValueProcessor constructor.
27
     */
28
    public function __construct(
1,914✔
29
        PropertyMetaDataCollection $propertyMetaDataCollection,
30
        SchemaProcessor $schemaProcessor,
31
        Schema $schema,
32
        private string $type = '',
33
    ) {
34
        parent::__construct($propertyMetaDataCollection, $schemaProcessor, $schema);
1,914✔
35
    }
36

37
    /**
38
     * @inheritdoc
39
     *
40
     * @throws ReflectionException
41
     * @throws SchemaException
42
     */
43
    public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
1,901✔
44
    {
45
        $json = $propertySchema->getJson();
1,901✔
46

47
        $property = (new Property(
1,901✔
48
            $propertyName,
1,901✔
49
            $this->type ? new PropertyType($this->type) : null,
1,901✔
50
            $propertySchema,
1,901✔
51
            $json['description'] ?? '',
1,901✔
52
        ))
1,901✔
53
            ->setRequired($this->propertyMetaDataCollection->isAttributeRequired($propertyName))
1,901✔
54
            ->setReadOnly(
1,901✔
55
                (isset($json['readOnly']) && $json['readOnly'] === true) ||
1,901✔
56
                (isset($json['readonly']) && $json['readonly'] === true) ||
1,901✔
57
                $this->schemaProcessor->getGeneratorConfiguration()->isImmutable(),
1,901✔
58
            );
1,901✔
59

60
        if (isset($json['readOnly'])) {
1,900✔
NEW
61
            trigger_error('Change from readOnly to readonly for property "' . $propertyName . '".', E_USER_DEPRECATED);
×
62
        }
63

64
        $this->generateValidators($property, $propertySchema);
1,900✔
65

66
        if (isset($json['filter'])) {
1,896✔
67
            (new FilterProcessor())->process(
108✔
68
                $property,
108✔
69
                $json['filter'],
108✔
70
                $this->schemaProcessor->getGeneratorConfiguration(),
108✔
71
                $this->schema,
108✔
72
            );
108✔
73
        }
74

75
        return $property;
1,877✔
76
    }
77
}
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