getName(); $reportMap[$name] ??= []; foreach(Utils::stringifyKeys($state->getStates()) as $propertyName => $value){ if($value instanceof IntTag || $value instanceof StringTag){ $rawValue = $value->getValue(); }elseif($value instanceof ByteTag){ $rawValue = match($value->getValue()){ 0 => false, 1 => true, default => throw new AssumptionFailedError("Unexpected ByteTag value for $name -> $propertyName ($value)") }; }else{ throw new AssumptionFailedError("Unexpected tag type for $name -> $propertyName ($value)"); } $reportMap[$name][$propertyName][get_class($value) . ":" . $value->getValue()] = $rawValue; } } foreach(Utils::stringifyKeys($reportMap) as $blockName => $propertyList){ foreach(Utils::stringifyKeys($propertyList) as $propertyName => $propertyValues){ ksort($propertyValues, SORT_NATURAL); $reportMap[$blockName][$propertyName] = array_values($propertyValues); } } ksort($reportMap, SORT_STRING); file_put_contents($outputFile, json_encode($reportMap, JSON_PRETTY_PRINT));