|
@@ -15,11 +15,11 @@ extern class Syntax {
|
|
`php` should be a string literal with php code.
|
|
`php` should be a string literal with php code.
|
|
It can contain placeholders like `{0}`, `{1}` which will be replaced with corresponding arguments from `args`.
|
|
It can contain placeholders like `{0}`, `{1}` which will be replaced with corresponding arguments from `args`.
|
|
E.g.:
|
|
E.g.:
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
Syntax.code("var_dump({0}, {1})", a, b);
|
|
Syntax.code("var_dump({0}, {1})", a, b);
|
|
```
|
|
```
|
|
will generate
|
|
will generate
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
var_dump($a, $b);
|
|
var_dump($a, $b);
|
|
```
|
|
```
|
|
**/
|
|
**/
|
|
@@ -172,18 +172,18 @@ extern class Syntax {
|
|
|
|
|
|
/**
|
|
/**
|
|
Generates PHP class name for a provided Haxe class.
|
|
Generates PHP class name for a provided Haxe class.
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
trace(Syntax.nativeClassName(php.Web)); // outputs: php\Web
|
|
trace(Syntax.nativeClassName(php.Web)); // outputs: php\Web
|
|
```
|
|
```
|
|
*/
|
|
*/
|
|
static function nativeClassName<T>(cls:EitherType<Class<T>, Enum<T>>) : String;
|
|
static function nativeClassName<T>(cls:EitherType<Class<T>, Enum<T>>) : String;
|
|
|
|
|
|
/**
|
|
/**
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
Syntax.foreach(collection, function(key, value) trace(key, value));
|
|
Syntax.foreach(collection, function(key, value) trace(key, value));
|
|
```
|
|
```
|
|
generates:
|
|
generates:
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
foreach($collection as $key => $value) {
|
|
foreach($collection as $key => $value) {
|
|
trace($key, $value);
|
|
trace($key, $value);
|
|
}
|
|
}
|
|
@@ -245,22 +245,22 @@ extern class Syntax {
|
|
static function staticCall( className:AsVar<EitherType<Class<Dynamic>,String>>, methodName:String, args:Rest<Dynamic> ) : Dynamic;
|
|
static function staticCall( className:AsVar<EitherType<Class<Dynamic>,String>>, methodName:String, args:Rest<Dynamic> ) : Dynamic;
|
|
|
|
|
|
/**
|
|
/**
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
Syntax.arrayDecl(arg1, arg2, arg3);
|
|
Syntax.arrayDecl(arg1, arg2, arg3);
|
|
```
|
|
```
|
|
Generates native array declaration:
|
|
Generates native array declaration:
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
[$arg1, $arg2, $arg3]
|
|
[$arg1, $arg2, $arg3]
|
|
```
|
|
```
|
|
**/
|
|
**/
|
|
static function arrayDecl<T>( args:Rest<T> ) : NativeIndexedArray<T>;
|
|
static function arrayDecl<T>( args:Rest<T> ) : NativeIndexedArray<T>;
|
|
|
|
|
|
/**
|
|
/**
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
Syntax.assocDecl({field1:'first', field2:2}});
|
|
Syntax.assocDecl({field1:'first', field2:2}});
|
|
```
|
|
```
|
|
Generates native associative array declaration:
|
|
Generates native associative array declaration:
|
|
- ```
|
|
|
|
|
|
+ ```haxe
|
|
["field1" => "first", "field2" => 2];
|
|
["field1" => "first", "field2" => 2];
|
|
```
|
|
```
|
|
This method is not recursive.
|
|
This method is not recursive.
|