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

View on GitHub
src/SchemaProcessor/PostProcessor/Templates/Serialization/PatternPropertiesSerializer.phptpl

Summary

Maintainability
Test Coverage
protected function serializePatternProperties(int $depth, array $except): array
{
    $serializedPatternProperties = [];

    foreach ($this->_patternProperties as $patternKey => $properties) {
        if ($customSerializer = $this->_getCustomSerializerMethod($patternKey)) {
            foreach ($this->{$customSerializer}() as $propertyKey => $value) {
                $serializedPatternProperties[$propertyKey] = $this->_getSerializedValue($value, $depth, $except);
            }
            continue;
        }

        foreach ($properties as $propertyKey => $value) {
            $serializedPatternProperties[$propertyKey] = $this->_getSerializedValue($value, $depth, $except);
        }
    }

    return $serializedPatternProperties;
}