Skip to content

Commit

Permalink
Added spacing in key-value-pair writer.
Browse files Browse the repository at this point in the history
  • Loading branch information
KSGRelewise committed Oct 10, 2024
1 parent db7781f commit 9ada81a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Generator/PhpTypeWriters/PhpKeyValuePairWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ namespace {Constants.Namespace};
writer.Indent++;

writer.WriteLine($"public {phpWriter.PhpTypeName(type.GenericTypeArguments[0])} $key;");
writer.WriteLine();
writer.WriteLine($"public {phpWriter.PhpTypeName(type.GenericTypeArguments[1])} $value;");
writer.WriteLine();

writer.WriteLine($"function __construct({phpWriter.PhpTypeName(type.GenericTypeArguments[0])} $key, {phpWriter.PhpTypeName(type.GenericTypeArguments[1])} $value)");
writer.WriteLine("{");
Expand All @@ -37,13 +39,15 @@ namespace {Constants.Namespace};
writer.WriteLine("$this->value = $value;");
writer.Indent--;
writer.WriteLine("}");
writer.WriteLine();

writer.WriteLine($"public static function create({phpWriter.PhpTypeName(type.GenericTypeArguments[0])} $key, {phpWriter.PhpTypeName(type.GenericTypeArguments[1])} $value) : {typeName}");
writer.WriteLine("{");
writer.Indent++;
writer.WriteLine($"return new {typeName}($key, $value);");
writer.Indent--;
writer.WriteLine("}");
writer.WriteLine();

writer.WriteLine($"public static function hydrate(array $arr) : {typeName}");
writer.WriteLine("{");
Expand Down
4 changes: 4 additions & 0 deletions src/Models/stringstringKeyValuePair.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
class stringstringKeyValuePair
{
public string $key;

public string $value;

function __construct(string $key, string $value)
{
$this->key = $key;
$this->value = $value;
}

public static function create(string $key, string $value) : stringstringKeyValuePair
{
return new stringstringKeyValuePair($key, $value);
}

public static function hydrate(array $arr) : stringstringKeyValuePair
{
return stringstringKeyValuePair::create($arr["key"], $arr["value"]);
Expand Down

0 comments on commit 9ada81a

Please sign in to comment.