class ZoneTemplateRecordValidationService (View source)

Validates zone template records before they are stored.

A template record is not a finished DNS record - it carries placeholders that are resolved per zone at creation time. It is checked by resolving those placeholders against a sample zone and validating the result with the normal per-type validators, which answers whether the record could ever be valid rather than whether it is valid for one particular zone.

The result reports validity only. Resolved values are sample data and must never be stored, so callers keep the values they were given.

Constants

private SAMPLE_ZONE

private SAMPLE_HOSTMASTER

private SAMPLE_TIMER

private PLACEHOLDER_SAMPLES

Stand-ins for the placeholders zone creation resolves. Sample values are used instead of this install's configuration so a record is judged on its own syntax and an unset nameserver or hostmaster setting cannot fail an otherwise sound record.

Methods

__construct(DnsValidatorRegistry $validatorRegistry)

No description

validate(string $name, string $type, string $content, mixed $ttl, mixed $prio, int $defaultTtl)

Check whether a template record could produce a valid DNS record.

Details

__construct(DnsValidatorRegistry $validatorRegistry)

No description

Parameters

DnsValidatorRegistry $validatorRegistry

ValidationResult validate(string $name, string $type, string $content, mixed $ttl, mixed $prio, int $defaultTtl)

Check whether a template record could produce a valid DNS record.

Parameters

string $name

Name part of the template record

string $type

Record type

string $content

Content part of the template record

mixed $ttl

TTL value

mixed $prio

Priority value

int $defaultTtl

Default TTL used when the record has none

Return Value

ValidationResult

Successful result carries true, never the resolved values