-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.kt
84 lines (64 loc) · 1.99 KB
/
extension.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import php.extension.dsl.extension
import php.extension.share.ArgumentType
val dsl = extension("example", "0.1") {
ini("example.count", "10")
ini("example.name", "example")
constant("EXAMPLE_WORLD", "World")
constant("EXAMPLE_LONG", 10L)
constant("HELLO_EN", "Hello")
constant("HELLO_ES", "Hola")
constant("HELLO_RU", "Привет")
constant("OK_HELLO", true)
phpClass("ExampleClass") {
constructor()
constant("CLASS_CONSTANT", "Yep!")
property("property", null)
property("sProperty", "sProp") {
static()
}
method("multipleProperty", ArgumentType.PHP_MIXED) {
arg(ArgumentType.PHP_LONG, "m")
}
method("printStatic")
method("getInstance", ArgumentType.PHP_OBJECT) {
static()
}
method("printObj") {
arg(ArgumentType.PHP_OBJECT, "obj")
}
}
function("hello", ArgumentType.PHP_STRING) {
arg(ArgumentType.PHP_STRING, "name")
arg(ArgumentType.PHP_STRING, "lang", true)
}
function("helloWorld", ArgumentType.PHP_BOOL)
function("multiple2", ArgumentType.PHP_DOUBLE) {
arg(ArgumentType.PHP_DOUBLE, "number")
}
function("multiple2long", ArgumentType.PHP_LONG) {
arg(ArgumentType.PHP_LONG, "number")
}
function("helloOrNotHello") {
arg(ArgumentType.PHP_BOOL, "hello")
}
function("iniValueFor", ArgumentType.PHP_STRING) {
arg(ArgumentType.PHP_STRING, "name")
}
function("printMixedType") {
arg(ArgumentType.PHP_MIXED, "value")
}
function("printMixed") {
arg(ArgumentType.PHP_ARRAY, "values")
}
function("printArray") {
arg(ArgumentType.PHP_ARRAY, "array")
}
function("getArray", ArgumentType.PHP_ARRAY) {
arg(ArgumentType.PHP_ARRAY, "array")
arg(ArgumentType.PHP_STRING, "key")
arg(ArgumentType.PHP_STRING, "value")
}
}
fun main(args: Array<String>) {
print(dsl.make())
}