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

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

21 Apr 2026 01:50PM UTC coverage: 25.265% (-1.8%) from 27.11%
24726187836

push

github

Enno Woortmann
Add MediaString and ImmutableMediaString value objects with filter callables

Introduces two value object classes (ValueObject/MediaString and
ValueObject/ImmutableMediaString) and their corresponding filter/serializer
callables (Filter/MediaString and Filter/ImmutableMediaString) to support
the contentMediaType and contentEncoding JSON Schema keywords.

Value objects carry the raw string value alongside schema-defined mediaType
and encoding metadata. The mutable variant exposes setValue(); the immutable
variant is fully readonly. Both implement Stringable.

Filter callables are separated from the value objects to keep concerns clean:
the value objects are pure data holders while the filter classes own the
transformation and serialization logic for the generator's filter pipeline.

0 of 45 new or added lines in 4 files covered. (0.0%)

167 of 661 relevant lines covered (25.26%)

0.84 hits per line

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

0.0
/src/ValueObject/ImmutableMediaString.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace PHPModelGenerator\ValueObject;
6

7
use Stringable;
8

9
/**
10
 * Immutable wrapper for a string property that carries contentMediaType / contentEncoding metadata.
11
 *
12
 * Used when readOnly: true, writeOnly: true, or global immutability is active.
13
 * The schema-defined media type and encoding are injected at construction time.
14
 */
15
class ImmutableMediaString implements Stringable
16
{
NEW
17
    public function __construct(
×
18
        private readonly string $value,
19
        private readonly ?string $mediaType = null,
20
        private readonly ?string $encoding = null,
NEW
21
    ) {}
×
22

NEW
23
    public function getValue(): string
×
24
    {
NEW
25
        return $this->value;
×
26
    }
27

NEW
28
    public function getMediaType(): ?string
×
29
    {
NEW
30
        return $this->mediaType;
×
31
    }
32

NEW
33
    public function getEncoding(): ?string
×
34
    {
NEW
35
        return $this->encoding;
×
36
    }
37

NEW
38
    public function __toString(): string
×
39
    {
NEW
40
        return $this->value;
×
41
    }
42
}
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