Skip to content

Commit 53a6686

Browse files
Merge pull request #531 from appwrite/fix-kotlin-array-examples
Manipulate array examples for Kotlin
2 parents 6597948 + 7aedc52 commit 53a6686

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/SDK/Language/Kotlin.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,17 @@ public function getParamExample(array $param)
228228
case self::TYPE_FILE:
229229
case self::TYPE_NUMBER:
230230
case self::TYPE_INTEGER:
231-
case self::TYPE_ARRAY:
232231
$output .= $example;
233232
break;
233+
case self::TYPE_ARRAY:
234+
if (\str_starts_with($example, '[')) {
235+
$example = \substr($example, 1);
236+
}
237+
if (\str_ends_with($example, ']')) {
238+
$example = \substr($example, 0, -1);
239+
}
240+
$output .= 'listOf(' . $example . ')';
241+
break;
234242
case self::TYPE_BOOLEAN:
235243
$output .= ($example) ? 'true' : 'false';
236244
break;

0 commit comments

Comments
 (0)