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

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

17 Apr 2026 03:57PM UTC coverage: 98.418% (-0.1%) from 98.551%
24574361886

Pull #126

github

Enno Woortmann
Merge remote-tracking branch 'origin/master' into jsonSchemaDraft7

# Conflicts:
#	composer.json
#	src/Model/GeneratorConfiguration.php
Pull Request #126: Json schema draft7

114 of 122 new or added lines in 6 files covered. (93.44%)

6 existing lines in 2 files now uncovered.

4666 of 4741 relevant lines covered (98.42%)

643.77 hits per line

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

57.14
/src/Model/Property/PropertyProxy.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace PHPModelGenerator\Model\Property;
6

7
use PHPModelGenerator\Exception\SchemaException;
8
use PHPModelGenerator\Model\Attributes\PhpAttribute;
9
use PHPModelGenerator\Model\GeneratorConfiguration;
10
use PHPModelGenerator\Model\Schema;
11
use PHPModelGenerator\Model\SchemaDefinition\JsonSchema;
12
use PHPModelGenerator\Model\SchemaDefinition\ResolvedDefinitionsCollection;
13
use PHPModelGenerator\Model\Validator\PropertyValidatorInterface;
14
use PHPModelGenerator\PropertyProcessor\Decorator\Property\PropertyDecoratorInterface;
15
use PHPModelGenerator\PropertyProcessor\Decorator\TypeHint\TypeHintDecoratorInterface;
16

17
/**
18
 * Class PropertyProxy
19
 *
20
 * @package PHPModelGenerator\Model
21
 */
22
class PropertyProxy extends AbstractProperty
23
{
24
    /**
25
     * PropertyProxy constructor.
26
     *
27
     * @param string $name The name must be provided separately as the name is not bound to the structure of a
28
     * referenced schema. Consequently, two properties with different names can refer an identical schema utilizing the
29
     * PropertyProxy. By providing a name to each of the proxies the resulting properties will get the correct names.
30
     *
31
     * @throws SchemaException
32
     */
33
    public function __construct(
815✔
34
        string $name,
35
        JsonSchema $jsonSchema,
36
        protected ResolvedDefinitionsCollection $definitionsCollection,
37
        protected string $key,
38
    ) {
39
        parent::__construct($name, $jsonSchema);
815✔
40
    }
41

42
    /**
43
     * Get the property out of the resolved definitions collection to proxy function calls
44
     */
45
    protected function getProperty(): PropertyInterface
815✔
46
    {
47
        return $this->definitionsCollection->offsetGet($this->key);
815✔
48
    }
49

50
    /**
51
     * @inheritdoc
52
     */
53
    public function getType(bool $outputType = false): ?PropertyType
141✔
54
    {
55
        return $this->getProperty()->getType($outputType);
141✔
56
    }
57

58
    /**
59
     * @inheritdoc
60
     */
61
    public function setType(
×
62
        ?PropertyType $type = null,
63
        ?PropertyType $outputType = null,
64
        bool $reset = false,
65
    ): PropertyInterface {
66
        return $this->getProperty()->setType($type, $outputType, $reset);
×
67
    }
68

69
    /**
70
     * @inheritdoc
71
     */
72
    public function getTypeHint(bool $outputType = false, array $skipDecorators = []): string
364✔
73
    {
74
        return $this->getProperty()->getTypeHint($outputType, $skipDecorators);
364✔
75
    }
76

77
    /**
78
     * @inheritdoc
79
     */
80
    public function addTypeHintDecorator(TypeHintDecoratorInterface $typeHintDecorator): PropertyInterface
×
81
    {
82
        return $this->getProperty()->addTypeHintDecorator($typeHintDecorator);
×
83
    }
84

85
    /**
86
     * @inheritdoc
87
     */
88
    public function getDescription(): string
13✔
89
    {
90
        return $this->getProperty()->getDescription();
13✔
91
    }
92

93
    public function getComment(): ?string
13✔
94
    {
95
        return $this->getProperty()->getComment();
13✔
96
    }
97

NEW
98
    public function setComment(string $comment): PropertyInterface
×
99
    {
NEW
100
        $this->getProperty()->setComment($comment);
×
101

NEW
102
        return $this;
×
103
    }
104

105
    public function getExamples(): array
13✔
106
    {
107
        return $this->getProperty()->getExamples();
13✔
108
    }
109

NEW
110
    public function setExamples(array $examples): PropertyInterface
×
111
    {
NEW
112
        $this->getProperty()->setExamples($examples);
×
113

NEW
114
        return $this;
×
115
    }
116

117
    /**
118
     * @inheritdoc
119
     */
120
    public function addValidator(PropertyValidatorInterface $validator, int $priority = 99): PropertyInterface
×
121
    {
122
        return $this->getProperty()->addValidator($validator, $priority);
×
123
    }
124

125
    /**
126
     * @inheritdoc
127
     */
128
    public function getValidators(): array
13✔
129
    {
130
        return $this->getProperty()->getValidators();
13✔
131
    }
132

133
    /**
134
     * @inheritdoc
135
     */
136
    public function filterValidators(callable $filter): PropertyInterface
803✔
137
    {
138
        return $this->getProperty()->filterValidators($filter);
803✔
139
    }
140

141
    /**
142
     * @inheritdoc
143
     */
144
    public function getOrderedValidators(): array
807✔
145
    {
146
        return array_map(
807✔
147
            fn(PropertyValidatorInterface $propertyValidator): PropertyValidatorInterface =>
807✔
148
                $propertyValidator->withProperty($this),
807✔
149
            $this->getProperty()->getOrderedValidators(),
807✔
150
        );
807✔
151
    }
152

153
    /**
154
     * @inheritdoc
155
     */
156
    public function addDecorator(PropertyDecoratorInterface $decorator): PropertyInterface
×
157
    {
158
        return $this->getProperty()->addDecorator($decorator);
×
159
    }
160

161
    /**
162
     * @inheritdoc
163
     */
164
    public function filterDecorators(callable $filter): PropertyInterface
×
165
    {
166
        return $this->getProperty()->filterDecorators($filter);
×
167
    }
168

169
    /**
170
     * @inheritdoc
171
     */
172
    public function resolveDecorator(string $input, bool $nestedProperty): string
666✔
173
    {
174
        foreach ($this->getProperty()->getDecorators() as $decorator) {
666✔
175
            $input = $decorator->decorate($input, $this, $nestedProperty);
666✔
176
        }
177

178
        return $input;
666✔
179
    }
180

181
    /**
182
     * @inheritdoc
183
     */
184
    public function getDecorators(): array
807✔
185
    {
186
        return $this->getProperty()->getDecorators();
807✔
187
    }
188

189
    /**
190
     * @inheritdoc
191
     */
192
    public function setRequired(bool $isPropertyRequired): PropertyInterface
×
193
    {
194
        return $this->getProperty()->setRequired($isPropertyRequired);
×
195
    }
196

197
    /**
198
     * @inheritdoc
199
     */
200
    public function isRequired(): bool
141✔
201
    {
202
        return $this->getProperty()->isRequired();
141✔
203
    }
204

205
    /**
206
     * @inheritdoc
207
     */
208
    public function setReadOnly(bool $isPropertyReadOnly): PropertyInterface
×
209
    {
210
        return $this->getProperty()->setReadOnly($isPropertyReadOnly);
×
211
    }
212

213
    /**
214
     * @inheritdoc
215
     */
216
    public function isReadOnly(): bool
13✔
217
    {
218
        return $this->getProperty()->isReadOnly();
13✔
219
    }
220

221
    /**
222
     * @inheritdoc
223
     */
NEW
224
    public function setWriteOnly(bool $isPropertyWriteOnly): PropertyInterface
×
225
    {
NEW
226
        return $this->getProperty()->setWriteOnly($isPropertyWriteOnly);
×
227
    }
228

229
    /**
230
     * @inheritdoc
231
     */
232
    public function isWriteOnly(): bool
13✔
233
    {
234
        return $this->getProperty()->isWriteOnly();
13✔
235
    }
236

237
    /**
238
     * @inheritdoc
239
     */
240
    public function setDefaultValue($defaultValue, bool $raw = false): PropertyInterface
×
241
    {
242
        return $this->getProperty()->setDefaultValue($defaultValue, $raw);
×
243
    }
244

245
    /**
246
     * @inheritdoc
247
     */
248
    public function getDefaultValue(): ?string
13✔
249
    {
250
        return $this->getProperty()->getDefaultValue();
13✔
251
    }
252

253
    /**
254
     * @inheritdoc
255
     */
256
    public function setNestedSchema(Schema $schema): PropertyInterface
×
257
    {
258
        return $this->getProperty()->setNestedSchema($schema);
×
259
    }
260

261
    /**
262
     * @inheritdoc
263
     */
264
    public function getNestedSchema(): ?Schema
720✔
265
    {
266
        return $this->getProperty()->getNestedSchema();
720✔
267
    }
268

269
    /**
270
     * @inheritdoc
271
     */
272
    public function getJsonSchema(): JsonSchema
×
273
    {
274
        return $this->getProperty()->getJsonSchema();
×
275
    }
276

277
    /**
278
     * @inheritdoc
279
     */
280
    public function setInternal(bool $isPropertyInternal): PropertyInterface
×
281
    {
282
        return $this->getProperty()->setInternal($isPropertyInternal);
×
283
    }
284

285
    /**
286
     * @inheritdoc
287
     */
288
    public function isInternal(): bool
13✔
289
    {
290
        return $this->getProperty()->isInternal();
13✔
291
    }
292

293
    /**
294
     * @inheritdoc
295
     */
296
    public function addAttribute(
×
297
        PhpAttribute $attribute,
298
        ?GeneratorConfiguration $generatorConfiguration = null,
299
        ?int $enablementFlag = null,
300
    ): static {
301
        $this->getProperty()->addAttribute($attribute);
×
302

303
        return $this;
×
304
    }
305

306
    /**
307
     * @inheritdoc
308
     */
309
    public function getAttributes(): array
13✔
310
    {
311
        return $this->getProperty()->getAttributes();
13✔
312
    }
313
}
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