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

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

13 Apr 2026 09:16AM UTC coverage: 98.264% (-0.4%) from 98.654%
24335532279

Pull #126

github

web-flow
Merge d850f110a into c010bb900
Pull Request #126: Json schema draft7

1462 of 1489 new or added lines in 63 files covered. (98.19%)

3 existing lines in 2 files now uncovered.

4358 of 4435 relevant lines covered (98.26%)

625.04 hits per line

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

59.7
/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\PhpAttribute;
9
use PHPModelGenerator\Model\SchemaDefinition\JsonSchema;
10
use PHPModelGenerator\Model\SchemaDefinition\ResolvedDefinitionsCollection;
11
use PHPModelGenerator\Model\Schema;
12
use PHPModelGenerator\Model\Validator\PropertyValidatorInterface;
13
use PHPModelGenerator\PropertyProcessor\Decorator\Property\PropertyDecoratorInterface;
14
use PHPModelGenerator\PropertyProcessor\Decorator\TypeHint\TypeHintDecoratorInterface;
15

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

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

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

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

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

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

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

92
    /**
93
     * @inheritdoc
94
     */
95
    public function addValidator(PropertyValidatorInterface $validator, int $priority = 99): PropertyInterface
×
96
    {
97
        return $this->getProperty()->addValidator($validator, $priority);
×
98
    }
99

100
    /**
101
     * @inheritdoc
102
     */
103
    public function getValidators(): array
13✔
104
    {
105
        return $this->getProperty()->getValidators();
13✔
106
    }
107

108
    /**
109
     * @inheritdoc
110
     */
111
    public function filterValidators(callable $filter): PropertyInterface
799✔
112
    {
113
        return $this->getProperty()->filterValidators($filter);
799✔
114
    }
115

116
    /**
117
     * @inheritdoc
118
     */
119
    public function getOrderedValidators(): array
803✔
120
    {
121
        return array_map(
803✔
122
            fn(PropertyValidatorInterface $propertyValidator): PropertyValidatorInterface =>
803✔
123
                $propertyValidator->withProperty($this),
803✔
124
            $this->getProperty()->getOrderedValidators(),
803✔
125
        );
803✔
126
    }
127

128
    /**
129
     * @inheritdoc
130
     */
131
    public function addDecorator(PropertyDecoratorInterface $decorator): PropertyInterface
×
132
    {
133
        return $this->getProperty()->addDecorator($decorator);
×
134
    }
135

136
    /**
137
     * @inheritdoc
138
     */
139
    public function filterDecorators(callable $filter): PropertyInterface
×
140
    {
141
        return $this->getProperty()->filterDecorators($filter);
×
142
    }
143

144
    /**
145
     * @inheritdoc
146
     */
147
    public function resolveDecorator(string $input, bool $nestedProperty): string
662✔
148
    {
149
        foreach ($this->getProperty()->getDecorators() as $decorator) {
662✔
150
            $input = $decorator->decorate($input, $this, $nestedProperty);
662✔
151
        }
152

153
        return $input;
662✔
154
    }
155

156
    /**
157
     * @inheritdoc
158
     */
159
    public function getDecorators(): array
803✔
160
    {
161
        return $this->getProperty()->getDecorators();
803✔
162
    }
163

164
    /**
165
     * @inheritdoc
166
     */
167
    public function setRequired(bool $isPropertyRequired): PropertyInterface
×
168
    {
169
        return $this->getProperty()->setRequired($isPropertyRequired);
×
170
    }
171

172
    /**
173
     * @inheritdoc
174
     */
175
    public function isRequired(): bool
141✔
176
    {
177
        return $this->getProperty()->isRequired();
141✔
178
    }
179

180
    /**
181
     * @inheritdoc
182
     */
183
    public function setReadOnly(bool $isPropertyReadOnly): PropertyInterface
×
184
    {
185
        return $this->getProperty()->setReadOnly($isPropertyReadOnly);
×
186
    }
187

188
    /**
189
     * @inheritdoc
190
     */
191
    public function isReadOnly(): bool
13✔
192
    {
193
        return $this->getProperty()->isReadOnly();
13✔
194
    }
195

196
    /**
197
     * @inheritdoc
198
     */
NEW
199
    public function setWriteOnly(bool $isPropertyWriteOnly): PropertyInterface
×
200
    {
NEW
201
        return $this->getProperty()->setWriteOnly($isPropertyWriteOnly);
×
202
    }
203

204
    /**
205
     * @inheritdoc
206
     */
207
    public function isWriteOnly(): bool
13✔
208
    {
209
        return $this->getProperty()->isWriteOnly();
13✔
210
    }
211

212
    /**
213
     * @inheritdoc
214
     */
215
    public function setDefaultValue($defaultValue, bool $raw = false): PropertyInterface
×
216
    {
217
        return $this->getProperty()->setDefaultValue($defaultValue, $raw);
×
218
    }
219

220
    /**
221
     * @inheritdoc
222
     */
223
    public function getDefaultValue(): ?string
13✔
224
    {
225
        return $this->getProperty()->getDefaultValue();
13✔
226
    }
227

228
    /**
229
     * @inheritdoc
230
     */
231
    public function setNestedSchema(Schema $schema): PropertyInterface
×
232
    {
233
        return $this->getProperty()->setNestedSchema($schema);
×
234
    }
235

236
    /**
237
     * @inheritdoc
238
     */
239
    public function getNestedSchema(): ?Schema
716✔
240
    {
241
        return $this->getProperty()->getNestedSchema();
716✔
242
    }
243

244
    /**
245
     * @inheritdoc
246
     */
247
    public function getJsonSchema(): JsonSchema
×
248
    {
249
        return $this->getProperty()->getJsonSchema();
×
250
    }
251

252
    /**
253
     * @inheritdoc
254
     */
255
    public function setInternal(bool $isPropertyInternal): PropertyInterface
×
256
    {
257
        return $this->getProperty()->setInternal($isPropertyInternal);
×
258
    }
259

260
    /**
261
     * @inheritdoc
262
     */
263
    public function isInternal(): bool
13✔
264
    {
265
        return $this->getProperty()->isInternal();
13✔
266
    }
267

268
    /**
269
     * @inheritdoc
270
     */
271
    public function addAttribute(PhpAttribute $attribute): static
×
272
    {
273
        $this->getProperty()->addAttribute($attribute);
×
274

275
        return $this;
×
276
    }
277

278
    /**
279
     * @inheritdoc
280
     */
281
    public function getAttributes(): array
13✔
282
    {
283
        return $this->getProperty()->getAttributes();
13✔
284
    }
285
}
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