Global.hx 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. package php;
  2. import haxe.extern.*;
  3. import haxe.Constraints;
  4. /**
  5. This class contains externs for native PHP functions defined in global namespace.
  6. For native PHP constants in global namespace see `php.Const`.
  7. **/
  8. @:phpGlobal
  9. extern class Global {
  10. /**
  11. @see http://php.net/manual/en/function.exit.php
  12. **/
  13. static function exit( status:EitherType<String,Int> ) : Void ;
  14. /**
  15. @see http://php.net/manual/en/function.exit.php
  16. **/
  17. static function die( status:EitherType<String,Int> ) : Void ;
  18. /**
  19. @see http://php.net/manual/en/function.error-reporting.php
  20. **/
  21. static function error_reporting( ?level:Int ) : Int ;
  22. /**
  23. @see http://php.net/manual/en/function.set-error-handler.php
  24. **/
  25. @:overload(function( error_handler:Int->String->Bool, ?error_types:Int ) : Dynamic {})
  26. @:overload(function( error_handler:Int->String->String->Bool, ?error_types:Int ) : Dynamic {})
  27. @:overload(function( error_handler:Int->String->String->Int->Bool, ?error_types:Int ) : Dynamic {})
  28. static function set_error_handler( ?error_handler:Int->String->String->Int->Array<Dynamic>->Bool, ?error_types:Int ) : Dynamic ;
  29. /**
  30. @see http://php.net/manual/en/function.restore-error-handler.php
  31. **/
  32. static function restore_error_handler() : Bool ;
  33. /**
  34. @see http://php.net/manual/en/function.set-exception-handler.php
  35. **/
  36. static function set_exception_handler( exception_handler:Throwable->Void ) : Dynamic ;
  37. /**
  38. @see http://php.net/manual/en/function.restore-exception-handler.php
  39. **/
  40. static function restore_exception_handler() : Bool ;
  41. /**
  42. @see http://php.net/manual/en/function.is-int.php
  43. **/
  44. static function is_int( value:Dynamic ) : Bool ;
  45. /**
  46. @see http://php.net/manual/en/function.is-float.php
  47. **/
  48. static function is_float( value:Dynamic ) : Bool ;
  49. /**
  50. @see http://php.net/manual/en/function.is-string.php
  51. **/
  52. static function is_string( value:Dynamic ) : Bool ;
  53. /**
  54. @see http://php.net/manual/en/function.is-numeric.php
  55. **/
  56. static function is_numeric( value:Dynamic ) : Bool ;
  57. /**
  58. @see http://php.net/manual/en/function.is-bool.php
  59. **/
  60. static function is_bool( value:Dynamic ) : Bool ;
  61. /**
  62. Checks if `values` is `php.NativeArray`
  63. @see http://php.net/manual/en/function.is-array.php
  64. **/
  65. static function is_array( value:Dynamic ) : Bool ;
  66. /**
  67. @see http://php.net/manual/en/function.is-object.php
  68. **/
  69. static function is_object( value:Dynamic ) : Bool ;
  70. /**
  71. @see http://php.net/manual/en/function.is-null.php
  72. **/
  73. static function is_null( value:Dynamic ) : Bool ;
  74. /**
  75. @see http://php.net/manual/en/function.is-subclass-of.php
  76. **/
  77. static function is_subclass_of( value:Dynamic, className:String, allow_string:Bool = true ) : Bool ;
  78. /**
  79. @see http://php.net/manual/en/function.class-exists.php
  80. **/
  81. static function class_exists( class_name:String, autoload:Bool = true ) : Bool ;
  82. /**
  83. @see http://php.net/manual/en/function.interface-exists.php
  84. **/
  85. static function interface_exists( interface_name:String, autoload:Bool = true ) : Bool ;
  86. /**
  87. @see http://php.net/manual/en/function.intval.php
  88. **/
  89. static function intval( value:Dynamic, base:Int = 10 ) : Int ;
  90. /**
  91. @see http://php.net/manual/en/function.floatval.php
  92. **/
  93. static function floatval( value:Dynamic ) : Float ;
  94. /**
  95. @see http://php.net/manual/en/function.boolval.php
  96. **/
  97. static function boolval( value:Dynamic ) : Bool ;
  98. /**
  99. @see http://php.net/manual/en/function.strval.php
  100. **/
  101. static function strval( value:Dynamic ) : String ;
  102. /**
  103. @see http://php.net/manual/en/function.phpversion.php
  104. **/
  105. static function phpversion( ?extension:String ) : String ;
  106. /**
  107. @see http://php.net/manual/en/function.class-alias.php
  108. **/
  109. static function class_alias( original:String, alias:String, autoload:Bool = true ) : Bool ;
  110. /**
  111. @see http://php.net/manual/en/function.count.php
  112. **/
  113. static function count( array:Dynamic, ?mode:Int ) : Int ;
  114. /**
  115. @see http://php.net/manual/en/function.array-filter.php
  116. **/
  117. @:overload(function(array:NativeArray,callback:Dynamic->Bool,?flag:Int):NativeArray {})
  118. static function array_filter( array:NativeArray, ?callback:Dynamic->?Dynamic->Bool, flag:Int = 0 ) : NativeArray ;
  119. /**
  120. @see http://php.net/manual/en/function.implode.php
  121. **/
  122. @:overload(function(pieces:NativeArray):String {})
  123. static function implode( glue:String, pieces:NativeArray ) : String ;
  124. /**
  125. @see http://php.net/manual/en/function.array-map.php
  126. **/
  127. static function array_map( callback:EitherType<Dynamic->Dynamic, String>, array:Rest<NativeArray> ) : NativeArray ;
  128. /**
  129. @see http://php.net/manual/en/function.array-merge.php
  130. **/
  131. static function array_merge( array:Rest<NativeArray> ) : NativeArray ;
  132. /**
  133. @see http://php.net/manual/en/function.array-diff.php
  134. **/
  135. static function array_diff( array:Rest<NativeArray> ) : NativeArray ;
  136. /**
  137. @see http://php.net/manual/en/function.array-pop.php
  138. **/
  139. static function array_pop( array:NativeArray ) : Dynamic;
  140. /**
  141. @see http://php.net/manual/en/function.array-push.php
  142. **/
  143. static function array_push( array:Ref<NativeArray>, value:Rest<Dynamic> ) : Int ;
  144. /**
  145. @see http://php.net/manual/en/function.array-reverse.php
  146. **/
  147. static function array_reverse( array:NativeArray, preserve_keys:Bool = false ) : NativeArray ;
  148. /**
  149. @see http://php.net/manual/en/function.array-search.php
  150. **/
  151. static function array_search( needle:Dynamic, haystack:NativeArray, strict:Bool = false) : EitherType<Bool,EitherType<String,Int>> ;
  152. /**
  153. @see http://php.net/manual/en/function.array-shift.php
  154. **/
  155. static function array_shift( array:Ref<NativeArray> ) : Dynamic ;
  156. /**
  157. @see http://php.net/manual/en/function.array-slice.php
  158. **/
  159. static function array_slice( array:NativeArray, offset:Int, length:Int = null, preserve_keys:Bool = false ) : NativeArray ;
  160. /**
  161. @see http://php.net/manual/en/function.array-splice.php
  162. **/
  163. static function array_splice( array:Ref<NativeArray>, offset:Int, lenght:Int = 0, ?replacement:Dynamic ) : NativeArray ;
  164. /**
  165. @see http://php.net/manual/en/function.array-unshift.php
  166. **/
  167. static function array_unshift( arr:Ref<NativeArray>, value:Rest<Dynamic> ) : Int ;
  168. /**
  169. @see http://php.net/manual/en/function.array-values.php
  170. **/
  171. static function array_values( arr:NativeArray ) : NativeIndexedArray<Dynamic> ;
  172. /**
  173. @see http://php.net/manual/en/function.array-keys.php
  174. **/
  175. static function array_keys( arr:NativeArray ) : NativeIndexedArray<EitherType<String,Int>> ;
  176. /**
  177. @see http://php.net/manual/en/function.array-key-exists.php
  178. **/
  179. static function array_key_exists( key:EitherType<String,Int>, arr:NativeArray ) : Bool ;
  180. /**
  181. @see http://php.net/manual/en/function.array-fill.php
  182. **/
  183. static function array_fill( start_index:Int, num:Int, value:Dynamic ) : NativeArray ;
  184. /**
  185. @see http://php.net/manual/en/function.array-pad.php
  186. **/
  187. static function array_pad( array:NativeArray, size:Int, value:Dynamic ) : NativeArray ;
  188. /**
  189. @see http://php.net/manual/en/function.in-array.php
  190. **/
  191. static function in_array( needle:Dynamic, haystack:NativeArray, strict:Bool = false ) : Bool ;
  192. /**
  193. @see http://php.net/manual/en/function.usort.php
  194. **/
  195. static function usort( array:Ref<NativeArray>, value_compare_func:Dynamic->Dynamic->Int ) : Bool ;
  196. /**
  197. @see http://php.net/manual/en/function.reset.php
  198. **/
  199. static function reset( array:Ref<NativeArray> ) : Dynamic;
  200. /**
  201. @see http://php.net/manual/en/function.current.php
  202. **/
  203. static function current( array:Ref<NativeArray> ) : Dynamic;
  204. /**
  205. @see http://php.net/manual/en/function.next.php
  206. **/
  207. static function next( array:Ref<NativeArray> ) : Dynamic;
  208. /**
  209. @see http://php.net/manual/en/function.prev.php
  210. **/
  211. static function prev( array:Ref<NativeArray> ) : Dynamic;
  212. /**
  213. @see http://php.net/manual/en/function.end.php
  214. **/
  215. static function end( array:Ref<NativeArray> ) : Dynamic;
  216. /**
  217. @see http://php.net/manual/en/function.key.php
  218. **/
  219. static function key( array:NativeArray ) : EitherType<String,Int>;
  220. /**
  221. @see http://php.net/manual/en/function.each.php
  222. **/
  223. static function each( array:Ref<NativeArray> ) : NativeArray;
  224. /**
  225. @see http://php.net/manual/en/function.defined.php
  226. **/
  227. static function defined( name:String ) : Bool;
  228. /**
  229. @see http://php.net/manual/en/function.constant.php
  230. */
  231. static function constant( name:String ) : Dynamic;
  232. /**
  233. @see http://php.net/manual/en/function.define.php
  234. **/
  235. static function define( name:String, value:Dynamic, case_insensitive:Bool = false ) : Bool;
  236. /**
  237. @see http://php.net/manual/en/function.echo.php
  238. **/
  239. static function echo( args:Rest<String> ) : Void;
  240. /**
  241. @see http://php.net/manual/en/function.sprintf.php
  242. **/
  243. static function sprintf( format:String, args:Rest<Dynamic> ) : EitherType<String,Bool>;
  244. /**
  245. @see http://php.net/manual/en/function.method-exists.php
  246. **/
  247. static function method_exists( object:Dynamic, method_name:String ) : Bool;
  248. /**
  249. @see http://php.net/manual/en/function.property-exists.php
  250. **/
  251. static function property_exists( object:Dynamic, property_name:String ) : Bool;
  252. /**
  253. @see http://php.net/manual/en/function.is-callable.php
  254. **/
  255. static function is_callable( value:Dynamic, syntax_only:Bool = false, ?callable_name:String ) : Bool;
  256. /**
  257. @see http://php.net/manual/en/function.isset.php
  258. **/
  259. static function isset( value:Dynamic, args:Rest<Dynamic> ) : Bool;
  260. /**
  261. @see http://php.net/manual/en/function.unset.php
  262. **/
  263. static function unset( value:Dynamic, values:Rest<Dynamic> ) : Void;
  264. /**
  265. @see http://php.net/manual/en/function.get-object-vars.php
  266. **/
  267. static function get_object_vars( object:{} ) : NativeAssocArray<Dynamic>;
  268. /**
  269. @see http://php.net/manual/en/function.get-class.php
  270. **/
  271. static function get_class( object:{} = null ) : EitherType<Bool,String>;
  272. /**
  273. @see http://php.net/manual/en/function.get-parent-class.php
  274. **/
  275. static function get_parent_class( ?object:Dynamic ) : EitherType<Bool,String>;
  276. /**
  277. @see http://php.net/manual/en/function.var-dump.php
  278. **/
  279. static function var_dump( args:Rest<Dynamic> ) : Void;
  280. /**
  281. @see http://php.net/manual/en/function.ord.php
  282. **/
  283. static function ord( string:String ) : Int;
  284. /**
  285. @see http://php.net/manual/en/function.chr.php
  286. **/
  287. static function chr( code:Int ) : String;
  288. /**
  289. @see http://php.net/manual/en/function.strpos.php
  290. **/
  291. static function strpos( haystack:String, needle:String, offset:Int = 0 ) : EitherType<Bool, Int>;
  292. /**
  293. @see http://php.net/manual/en/function.strrpos.php
  294. **/
  295. static function strrpos( haystack:String, needle:String, offset:Int = 0 ) : EitherType<Bool, Int>;
  296. /**
  297. @see http://php.net/manual/en/function.str-split.php
  298. **/
  299. static function str_split( string:String, split_length:Int = 1 ) : EitherType<Bool,NativeIndexedArray<String>>;
  300. /**
  301. @see http://php.net/manual/en/function.strlen.php
  302. **/
  303. static function strlen( string:String ) : Int;
  304. /**
  305. @see http://php.net/manual/en/function.strcmp.php
  306. **/
  307. static function strcmp( str1:String, str2:String ) : Int;
  308. /**
  309. @see http://php.net/manual/en/function.str-repeat.php
  310. **/
  311. static function str_repeat( input:String, multiplier:Int ) : String;
  312. /**
  313. @see http://php.net/manual/en/function.str-replace.php
  314. **/
  315. static function str_replace( search:EitherType<String,NativeArray>, replace:EitherType<String,NativeArray>, subject:EitherType<String,NativeArray>, ?count:Int ) : EitherType<String,NativeArray>;
  316. /**
  317. @see http://php.net/manual/en/function.explode.php
  318. **/
  319. static function explode( delimiter:String, string:String, ?limit:Int ) : EitherType<Bool,NativeIndexedArray<String>>;
  320. /**
  321. @see http://php.net/manual/en/function.substr.php
  322. **/
  323. static function substr( string:String, start:Int, ?length:Int ) : EitherType<Bool,String>;
  324. /**
  325. @see http://php.net/manual/en/function.substr_replace.php
  326. **/
  327. static function substr_replace( string:EitherType<String,NativeArray>, replacement:EitherType<String,NativeArray>, start:EitherType<Int,NativeArray>, ?length:EitherType<Int,NativeArray> ) : EitherType<String,NativeArray>;
  328. /**
  329. @see http://php.net/manual/en/function.strtoupper.php
  330. **/
  331. static function strtoupper( string:String ) : String;
  332. /**
  333. @see http://php.net/manual/en/function.strtolower.php
  334. **/
  335. static function strtolower( string:String ) : String;
  336. /**
  337. @see http://php.net/manual/en/function.debug-backtrace.php
  338. **/
  339. static function debug_backtrace( ?options:Int, ?limit:Int ) : NativeIndexedArray<NativeAssocArray<Dynamic>>;
  340. /**
  341. @see http://php.net/manual/en/function.call-user-func.php
  342. **/
  343. static function call_user_func( callback:Dynamic, arguments:Rest<Dynamic> ) : Dynamic;
  344. /**
  345. @see http://php.net/manual/en/function.call-user-func-array.php
  346. **/
  347. static function call_user_func_array( callback:Dynamic, arguments:NativeArray ) : Dynamic;
  348. /**
  349. @see http://php.net/manual/en/function.func-get-args.php
  350. **/
  351. static function func_get_args() : NativeIndexedArray<Dynamic>;
  352. /**
  353. @see http://php.net/manual/en/function.abs.php
  354. **/
  355. static function abs<T:Float>( number:T ) : T;
  356. /**
  357. @see http://php.net/manual/en/function.min.php
  358. **/
  359. static function min( values:Rest<Dynamic> ) : Dynamic;
  360. /**
  361. @see http://php.net/manual/en/function.max.php
  362. **/
  363. static function max( values:Rest<Dynamic> ) : Dynamic;
  364. /**
  365. @see http://php.net/manual/en/function.sin.php
  366. **/
  367. static function sin( arg:Float ) : Float;
  368. /**
  369. @see http://php.net/manual/en/function.cos.php
  370. **/
  371. static function cos( arg:Float ) : Float;
  372. /**
  373. @see http://php.net/manual/en/function.atan2.php
  374. **/
  375. static function atan2( y:Float, x:Float ) : Float;
  376. /**
  377. @see http://php.net/manual/en/function.tan.php
  378. **/
  379. static function tan( arg:Float ) : Float;
  380. /**
  381. @see http://php.net/manual/en/function.exp.php
  382. **/
  383. static function exp( arg:Float ) : Float;
  384. /**
  385. @see http://php.net/manual/en/function.log.php
  386. **/
  387. static function log( arg:Float ) : Float;
  388. /**
  389. @see http://php.net/manual/en/function.sqrt.php
  390. **/
  391. static function sqrt( arg:Float ) : Float;
  392. /**
  393. @see http://php.net/manual/en/function.floor.php
  394. **/
  395. static function floor( arg:Float ) : Float;
  396. /**
  397. @see http://php.net/manual/en/function.ceil.php
  398. **/
  399. static function ceil( arg:Float ) : Float;
  400. /**
  401. @see http://php.net/manual/en/function.round.php
  402. **/
  403. static function round( val:Float, precision:Int = 0, ?mode:Int ) : Float;
  404. /**
  405. @see http://php.net/manual/en/function.atan.php
  406. **/
  407. static function atan( arg:Float ) : Float;
  408. /**
  409. @see http://php.net/manual/en/function.asin.php
  410. **/
  411. static function asin( arg:Float ) : Float;
  412. /**
  413. @see http://php.net/manual/en/function.acos.php
  414. **/
  415. static function acos( arg:Float ) : Float;
  416. /**
  417. @see http://php.net/manual/en/function.pow.php
  418. **/
  419. static function pow( base:Float, exp:Float ) : Float;
  420. /**
  421. @see http://php.net/manual/en/function.mt-rand.php
  422. **/
  423. @:overload(function() : Int {})
  424. static function mt_rand( base:Int, exp:Int ) : Int;
  425. /**
  426. @see http://php.net/manual/en/function.mt-getrandmax.php
  427. **/
  428. static function mt_getrandmax() : Int;
  429. /**
  430. @see http://php.net/manual/en/function.is-nan.php
  431. **/
  432. static function is_nan( arg:Float ) : Bool;
  433. /**
  434. @see http://php.net/manual/en/function.is-finite.php
  435. **/
  436. static function is_finite( arg:Float ) : Bool;
  437. /**
  438. @see http://php.net/manual/en/function.trim.php
  439. **/
  440. static function trim( str:String, ?character_mask:String ) : String;
  441. /**
  442. @see http://php.net/manual/en/function.rtrim.php
  443. **/
  444. static function rtrim( str:String, ?character_mask:String ) : String;
  445. /**
  446. @see http://php.net/manual/en/function.ltrim.php
  447. **/
  448. static function ltrim( str:String, ?character_mask:String ) : String;
  449. /**
  450. @see http://php.net/manual/en/function.getenv.php
  451. **/
  452. static function getenv( varname:String ) : EitherType<String,Bool>;
  453. /**
  454. @see http://php.net/manual/en/function.putenv.php
  455. **/
  456. static function putenv( setting:String ) : Bool;
  457. /**
  458. @see http://php.net/manual/en/function.sleep.php
  459. **/
  460. static function sleep( seconds:Int ) : EitherType<Bool,Int>;
  461. /**
  462. @see http://php.net/manual/en/function.usleep.php
  463. **/
  464. static function usleep( micro_seconds:Int ) : Void;
  465. /**
  466. @see http://php.net/manual/en/function.setlocale.php
  467. **/
  468. @:overload(function( category:Int, locale:NativeIndexedArray<String> ) : EitherType<Bool,String> {})
  469. static function setlocale( category:Int, locale:Rest<String> ) : EitherType<Bool,String>;
  470. /**
  471. @see http://php.net/manual/en/function.getcwd.php
  472. **/
  473. static function getcwd() : EitherType<String,Bool>;
  474. /**
  475. @see http://php.net/manual/en/function.chdir.php
  476. **/
  477. static function chdir( directory:String ) : Bool;
  478. /**
  479. @see http://php.net/manual/en/function.php-uname.php
  480. **/
  481. static function php_uname( mode:String = 'a' ) : String;
  482. /**
  483. @see http://php.net/manual/en/function.system.php
  484. **/
  485. static function system( command:String, ?return_var:Ref<Int> ) : EitherType<String,Bool>;
  486. /**
  487. @see http://php.net/manual/en/function.microtime.php
  488. **/
  489. static function microtime( get_as_float:Bool = false ) : EitherType<Float,String>;
  490. /**
  491. @see http://php.net/manual/en/function.fopen.php
  492. **/
  493. static function fopen( filename:String, mode:String, use_include_path:Bool = false, ?context:Resource ) : EitherType<Bool,Resource>;
  494. /**
  495. @see http://php.net/manual/en/function.fclose.php
  496. **/
  497. static function fclose( handle:Resource ) : Bool;
  498. /**
  499. @see http://php.net/manual/en/function.feof.php
  500. **/
  501. static function feof( handle:Resource ) : Bool;
  502. /**
  503. @see http://php.net/manual/en/function.fseek.php
  504. **/
  505. static function fseek( handle:Resource, offset:Int, ?whence:Int ) : EitherType<Int,Bool>;
  506. /**
  507. @see http://php.net/manual/en/function.ftell.php
  508. **/
  509. static function ftell( handle:Resource ) : EitherType<Int,Bool>;
  510. /**
  511. @see http://php.net/manual/en/function.rewind.php
  512. **/
  513. static function rewind( handle:Resource ) : Bool;
  514. /**
  515. @see http://php.net/manual/en/function.fgetc.php
  516. **/
  517. static function fgetc( handle:Resource ) : EitherType<Bool,String>;
  518. /**
  519. @see http://php.net/manual/en/function.fgets.php
  520. **/
  521. static function fgets( handle:Resource ) : EitherType<Bool,String>;
  522. /**
  523. @see http://php.net/manual/en/function.fflush.php
  524. **/
  525. static function fflush( handle:Resource ) : Bool;
  526. /**
  527. @see http://php.net/manual/en/function.fwrite.php
  528. **/
  529. static function fwrite( handle:Resource, string:String, ?length:Int ) : EitherType<Int,Bool>;
  530. /**
  531. @see http://php.net/manual/en/function.fread.php
  532. **/
  533. static function fread( handle:Resource, length:Int ) : EitherType<Bool,String>;
  534. /**
  535. @see http://php.net/manual/en/function.file-exists.php
  536. **/
  537. static function file_exists( filename:String ) : Bool;
  538. /**
  539. @see http://php.net/manual/en/function.file-get-contents.php
  540. **/
  541. static function file_get_contents( filename:String, use_include_path:Bool = false, ?context:Resource, offset:Int = 0, ?maxlen:Int ) : EitherType<String,Bool>;
  542. /**
  543. @see http://php.net/manual/en/function.file-put-contents.php
  544. **/
  545. static function file_put_contents( filename:String, data:Dynamic, flags:Int = 0, ?context:Resource ) : EitherType<Int,Bool>;
  546. /**
  547. @see http://php.net/manual/en/function.clearstatcache.php
  548. **/
  549. static function clearstatcache( clear_realpath_cache:Bool = false, ?filename:String ) : Bool;
  550. /**
  551. @see http://php.net/manual/en/function.fstat.php
  552. **/
  553. static function fstat( handle:Resource ) : NativeArray;
  554. /**
  555. @see http://php.net/manual/en/function.stat.php
  556. **/
  557. static function stat( filename:String ) : EitherType<NativeArray,Bool>;
  558. /**
  559. @see http://php.net/manual/en/function.realpath.php
  560. **/
  561. static function realpath( path:String ) : EitherType<String,Bool>;
  562. /**
  563. @see http://php.net/manual/en/function.filetype.php
  564. **/
  565. static function filetype( filename:String ) : EitherType<String,Bool>;
  566. /**
  567. @see http://php.net/manual/en/function.mkdir.php
  568. **/
  569. static function mkdir( pathname:String, mode:Int = 511, recursive:Bool = false, ?context:Resource ) : Bool;
  570. /**
  571. @see http://php.net/manual/en/function.unlink.php
  572. **/
  573. static function unlink( filename:String, ?context:Resource ) : Bool;
  574. /**
  575. @see http://php.net/manual/en/function.rmdir.php
  576. **/
  577. static function rmdir( dirname:String, ?context:Resource ) : Bool;
  578. /**
  579. @see http://php.net/manual/en/function.dirname.php
  580. **/
  581. static function dirname( path:String, levels:Int = 1 ) : String;
  582. /**
  583. @see http://php.net/manual/en/function.glob.php
  584. **/
  585. static function glob( pattern:String, flags:Int = 0 ) : NativeArray;
  586. /**
  587. @see http://php.net/manual/en/function.opendir.php
  588. **/
  589. static function opendir( path:String, ?context:Resource ) : EitherType<Resource,Bool>;
  590. /**
  591. @see http://php.net/manual/en/function.closedir.php
  592. **/
  593. static function closedir( dir_handle:Resource ) : Void;
  594. /**
  595. @see http://php.net/manual/en/function.readdir.php
  596. **/
  597. static function readdir( ?dir_handle:Resource ) : EitherType<String,Bool>;
  598. /**
  599. @see http://php.net/manual/en/function.rewinddir.php
  600. **/
  601. static function rewinddir( ?dir_handle:Resource ) : Void;
  602. /**
  603. @see http://php.net/manual/en/function.is-dir.php
  604. **/
  605. static function is_dir( filename:String ) : Bool;
  606. /**
  607. @see http://php.net/manual/en/function.rename.php
  608. **/
  609. static function rename( oldname:String, newname:String, ?context:Resource ) : Bool;
  610. /**
  611. @see http://php.net/manual/en/function.copy.php
  612. **/
  613. static function copy( source:String, dest:String, ?context:Resource ) : Bool;
  614. /**
  615. @see http://php.net/manual/en/function.preg-match.php
  616. **/
  617. static function preg_match( pattern:String, subject:String, ?matches:NativeArray, ?flags:Int, ?offset:Int ) : EitherType<Bool,Int> ;
  618. /**
  619. @see http://php.net/manual/en/function.preg-match-all.php
  620. **/
  621. static function preg_match_all( pattern:String, subject:String, ?matches:NativeArray, ?flags:Int, ?offset:Int ) : EitherType<Bool,Int> ;
  622. /**
  623. @see http://php.net/manual/en/function.preg-quote.php
  624. **/
  625. static function preg_quote( str:String, ?delimiter:String ) : String;
  626. /**
  627. @see http://php.net/manual/en/function.preg-split.php
  628. **/
  629. static function preg_split( pattern:String, subject:String, limit:Int = -1, flags:Int = 0 ) : EitherType<Bool,NativeArray> ;
  630. /**
  631. @see http://php.net/manual/en/function.preg-replace.php
  632. **/
  633. static function preg_replace( pattern:EitherType<String,NativeArray>, replacement:EitherType<String,NativeArray>, subject:EitherType<String,NativeArray>, limit:Int = -1, ?count:Int ) : EitherType<String,NativeArray> ;
  634. /**
  635. @see http://php.net/manual/en/function.md5.php
  636. **/
  637. static function md5( str:String, raw_output:Bool = false ) : String;
  638. /**
  639. @see http://php.net/manual/en/function.sha1.php
  640. **/
  641. static function sha1( str:String, raw_output:Bool = false ) : String;
  642. /**
  643. @see http://php.net/manual/en/function.hash.php
  644. **/
  645. static function hash( algo:String, str:String, raw_output:Bool = false ) : String;
  646. /**
  647. @see http://php.net/manual/en/function.pack.php
  648. **/
  649. static function pack( format:String, args:Rest<Dynamic> ) : String;
  650. /**
  651. @see http://php.net/manual/en/function.unpack.php
  652. **/
  653. static function unpack( format:String, data:String ) : NativeArray;
  654. /**
  655. @see http://php.net/manual/en/function.chunk-split.php
  656. **/
  657. static function chunk_split( body:String, chunklen:Int = 76, end:String = "\r\n" ) : String;
  658. /**
  659. @see http://php.net/manual/en/function.urlencode.php
  660. **/
  661. static function urlencode( str:String ) : String;
  662. /**
  663. @see http://php.net/manual/en/function.urldecode.php
  664. **/
  665. static function urldecode( str:String ) : String;
  666. /**
  667. @see http://php.net/manual/en/function.rawurlencode.php
  668. **/
  669. static function rawurlencode( str:String ) : String;
  670. /**
  671. @see http://php.net/manual/en/function.rawurldecode.php
  672. **/
  673. static function rawurldecode( str:String ) : String;
  674. /**
  675. @see http://php.net/manual/en/function.header.php
  676. **/
  677. static function header( string:String, replace:Bool = true, ?http_response_code:Int ) : Void;
  678. /**
  679. @see http://php.net/manual/en/function.setcookie.php
  680. **/
  681. static function setcookie( name:String, value:String = "", expire:Int = 0, path:String = "", domain:String = "", secure:Bool = false, httponly:Bool = false ) : Bool;
  682. /**
  683. @see http://php.net/manual/en/function.htmlspecialchars.php
  684. **/
  685. static function htmlspecialchars( string:String, ?flags:Int, ?encoding:String, double_encode:Bool = true ) : String;
  686. /**
  687. @see http://php.net/manual/en/function.htmlspecialchars_decode.php
  688. **/
  689. static function htmlspecialchars_decode( string:String, ?flags:Int ) : String;
  690. /**
  691. @see http://php.net/manual/en/function.str-pad.php
  692. **/
  693. static function str_pad( input:String, pad_length:Int, pad_String:String = ' ', ?pad_type:Int ) : String;
  694. /**
  695. @see http://php.net/manual/en/function.dechex.php
  696. **/
  697. static function dechex( number:Int ) : String;
  698. /**
  699. @see http://php.net/manual/en/function.hexdec.php
  700. **/
  701. static function hexdec( hex_string:String ) : Int;
  702. /**
  703. @see http://php.net/manual/en/function.bin2hex.php
  704. **/
  705. static function bin2hex( str:String ) : String;
  706. /**
  707. @see http://php.net/manual/en/function.hex2bin.php
  708. **/
  709. static function hex2bin( str:String ) : EitherType<String,Bool>;
  710. /**
  711. @see http://php.net/manual/en/function.serialize.php
  712. **/
  713. static function serialize( value:Dynamic ) : String;
  714. /**
  715. @see http://php.net/manual/en/function.unserialize.php
  716. **/
  717. static function unserialize( str:String, ?options:NativeArray ) : Dynamic;
  718. /**
  719. @see http://php.net/manual/en/function.extension-loaded.php
  720. **/
  721. static function extension_loaded( name:String ) : Bool;
  722. /**
  723. @see http://php.net/manual/en/function.strncasecmp.php
  724. **/
  725. static function strncasecmp( str1:String, str2:String, len:Int ) : Int;
  726. /**
  727. @see http://php.net/manual/en/function.strcasecmp.php
  728. **/
  729. static function strcasecmp( str1:String, str2:String ) : Int;
  730. /**
  731. @see http://php.net/manual/en/function.fpassthru.php
  732. **/
  733. static function fpassthru( handle:Resource ) : Int;
  734. /**
  735. @see http://php.net/manual/en/function.json-encode.php
  736. **/
  737. static function json_encode( value:Dynamic, options:Int = 0, depth:Int = 512 ) : EitherType<String,Bool>;
  738. /**
  739. @see http://php.net/manual/en/function.json-decode.php
  740. **/
  741. static function json_decode( json:String, assoc:Bool = false, depth:Int = 512, options:Int = 512 ) : Dynamic;
  742. /**
  743. @see http://php.net/manual/en/function.json-last-error.php
  744. **/
  745. static function json_last_error() : Int;
  746. /**
  747. @see http://php.net/manual/en/function.json-last-error-msg.php
  748. **/
  749. static function json_last_error_msg() : EitherType<String,Bool>;
  750. /**
  751. @see http://php.net/manual/en/function.spl-object-hash.php
  752. **/
  753. static function spl_object_hash( obj:{} ) : String;
  754. /**
  755. @see http://php.net/manual/en/function.utf8-encode.php
  756. **/
  757. static function utf8_encode( data:String ) : String;
  758. /**
  759. @see http://php.net/manual/en/function.utf8-decode.php
  760. **/
  761. static function utf8_decode( data:String ) : String;
  762. /**
  763. @see http://php.net/manual/en/function.mb-convert-encoding.php
  764. **/
  765. static function mb_convert_encoding( str:String, to_encoding:String, ?from_encoding:Dynamic ) : String;
  766. /**
  767. @see http://php.net/manual/en/function.mb-check-encoding.php
  768. **/
  769. static function mb_check_encoding( str:String = null, ?encoding:String ) : Bool;
  770. /**
  771. @see http://php.net/manual/en/function.mb-strlen.php
  772. **/
  773. static function mb_strlen( str:String, ?encoding:String ) : EitherType<Int,Bool>;
  774. /**
  775. @see http://php.net/manual/en/function.mb-substr.php
  776. **/
  777. static function mb_substr( str:String, start:Int, length:Int = null, ?encoding:String ) : String;
  778. /**
  779. @see http://php.net/manual/en/function.proc-open.php
  780. **/
  781. static function proc_open( cmd:String, descriptorspec:NativeArray, pipes:NativeIndexedArray<Resource>, ?cwd:String, ?env:NativeArray, ?other_options:NativeArray ) : EitherType<Resource,Bool>;
  782. /**
  783. @see http://php.net/manual/en/function.proc-get-status.php
  784. **/
  785. static function proc_get_status( process:Resource ) : EitherType<Bool,NativeAssocArray<Scalar>>;
  786. /**
  787. @see http://php.net/manual/en/function.proc-close.php
  788. **/
  789. static function proc_close( process:Resource ) : Int;
  790. /**
  791. @see http://php.net/manual/en/function.proc-terminate.php
  792. **/
  793. static function proc_terminate( process:Resource, signal:Int = 15 ) : Bool;
  794. /**
  795. @see http://php.net/manual/en/function.stream-select.php
  796. **/
  797. static function stream_select( read:NativeArray, write:NativeArray, except:NativeArray, tv_sec:Int, tv_usec:Int = 0 ) : Bool;
  798. /**
  799. @see http://php.net/manual/en/function.stream-socket-shutdown.php
  800. **/
  801. static function stream_socket_shutdown( stream:Resource, how:Int ) : Bool;
  802. /**
  803. @see http://php.net/manual/en/function.stream-set-timeout.php
  804. **/
  805. static function stream_set_timeout( stream:Resource, seconds:Int, microseconds:Int = 0 ) : Bool;
  806. /**
  807. @see http://php.net/manual/en/function.stream-set-blocking.php
  808. **/
  809. static function stream_set_blocking( stream:Resource, mode:Bool ) : Bool;
  810. /**
  811. @see http://php.net/manual/en/function.stream-socket-accept.php
  812. **/
  813. static function stream_socket_accept( server_socket:Resource, ?timeout:Float, ?peername:Ref<String> ) : EitherType<Resource,Bool>;
  814. /**
  815. @see http://php.net/manual/en/function.stream-socket-client.php
  816. **/
  817. static function stream_socket_client( remote_socket:String, ?errno:Ref<Int>, ?errstr:Ref<String>, ?timeout:Float, ?flags:Int, ?context:Resource ) : EitherType<Resource,Bool>;
  818. /**
  819. @see http://php.net/manual/en/function.stream-socket-server.php
  820. **/
  821. static function stream_socket_server( local_socket:String, ?errno:Ref<Int>, ?errstr:Ref<String>, ?flags:Int, ?context:Resource ) : EitherType<Resource,Bool>;
  822. /**
  823. @see http://php.net/manual/en/function.stream-socket-get-name.php
  824. **/
  825. static function stream_socket_get_name( stream:Resource, want_peer:Bool ) : EitherType<String,Bool>;
  826. /**
  827. @see http://php.net/manual/en/function.ini-get.php
  828. **/
  829. static function ini_get( var_name:String ) : EitherType<Bool,String>;
  830. /**
  831. @see http://php.net/manual/en/function.ini-set.php
  832. **/
  833. static function ini_set( var_name:String, newvalue:String ) : EitherType<Bool,String>;
  834. /**
  835. @see http://php.net/manual/en/function.sqlite-error-string.php
  836. **/
  837. static function sqlite_error_string( error_code:Int ) : String;
  838. /**
  839. @see http://php.net/manual/en/function.sqlite-escape-string.php
  840. **/
  841. static function sqlite_escape_string( item:String ) : String;
  842. /**
  843. @see http://php.net/manual/en/function.set-time-limit.php
  844. **/
  845. static function set_time_limit( seconds:Int ) : Bool;
  846. /**
  847. @see http://php.net/manual/en/function.function-exists.php
  848. **/
  849. static function function_exists( function_name:String ) : Bool;
  850. /**
  851. @see http://php.net/manual/en/function.getallheaders.php
  852. **/
  853. static function getallheaders() : NativeAssocArray<Dynamic>;
  854. /**
  855. @see http://php.net/manual/en/function.ucwords.php
  856. **/
  857. static function ucwords( str:String, ?delimiters:String ) : String;
  858. /**
  859. @see http://php.net/manual/en/function.base64-encode.php
  860. **/
  861. static function base64_encode( data:String ) : EitherType<String,Bool>;
  862. /**
  863. @see http://php.net/manual/en/function.base64-decode.php
  864. **/
  865. static function base64_decode( data:String, strict:Bool = false ) : EitherType<String,Bool>;
  866. /**
  867. @see http://php.net/manual/en/function.gethostbyname.php
  868. **/
  869. static function gethostbyname( hostname:String ) : String;
  870. /**
  871. @see http://php.net/manual/en/function.gethostbyaddr.php
  872. **/
  873. static function gethostbyaddr( ip_address:String ) : EitherType<String,Bool>;
  874. /**
  875. @see http://php.net/manual/en/function.getprotobyname.php
  876. **/
  877. static function getprotobyname( name:String ) : EitherType<Int,Bool>;
  878. /**
  879. @see http://php.net/manual/en/function.mktime.php
  880. **/
  881. static function mktime( ?hour:Int, ?minute:Int, ?second:Int, ?month:Int, ?day:Int, ?year:Int, ?is_dst:Int ) : EitherType<Int,Bool>;
  882. /**
  883. @see http://php.net/manual/en/function.gmmktime.php
  884. **/
  885. static function gmmktime( ?hour:Int, ?minute:Int, ?second:Int, ?month:Int, ?day:Int, ?year:Int, ?is_dst:Int ) : Int;
  886. /**
  887. @see http://php.net/manual/en/function.date.php
  888. **/
  889. static function date( format:String, ?timestamp:Int ) : EitherType<String,Bool>;
  890. /**
  891. @see http://php.net/manual/en/function.strtotime.php
  892. **/
  893. static function strtotime( time:String, ?now:Int ) : EitherType<Int,Bool>;
  894. /**
  895. @see http://php.net/manual/en/function.flush.php
  896. **/
  897. static function flush() : Void;
  898. /**
  899. @see http://php.net/manual/en/function.session-cache-limiter.php
  900. **/
  901. static function session_cache_limiter( ?cache_limiter:String ) : String;
  902. /**
  903. @see http://php.net/manual/en/function.session-cache-expire.php
  904. **/
  905. static function session_cache_expire( ?new_cache_expire:Int ) : Int;
  906. /**
  907. @see http://php.net/manual/en/function.session-name.php
  908. **/
  909. static function session_name( ?name:String ) : String;
  910. /**
  911. @see http://php.net/manual/en/function.session-start.php
  912. **/
  913. static function session_start( ?options:NativeArray ) : Bool;
  914. /**
  915. @see http://php.net/manual/en/function.session-unset.php
  916. **/
  917. static function session_unset() : Void;
  918. /**
  919. @see http://php.net/manual/en/function.session-write-close.php
  920. **/
  921. static function session_write_close() : Void;
  922. /**
  923. @see http://php.net/manual/en/function.session-id.php
  924. **/
  925. static function session_id( ?id:String ) : String;
  926. /**
  927. @see http://php.net/manual/en/function.session-save-path.php
  928. **/
  929. static function session_save_path( ?path:String ) : String;
  930. /**
  931. @see http://php.net/manual/en/function.session-module-name.php
  932. **/
  933. static function session_module_name( ?module:String ) : String;
  934. /**
  935. @see http://php.net/manual/en/function.session-regenerate-id.php
  936. **/
  937. static function session_regenerate_id( delete_old_session:Bool = false ) : Bool;
  938. /**
  939. @see http://php.net/manual/en/function.session-set-cookie-params.php
  940. **/
  941. static function session_set_cookie_params( lifetime:Int, ?path:String, ?domain:String, secure:Bool = false, httponly:Bool = false ) : Bool;
  942. /**
  943. @see http://php.net/manual/en/function.session-get-cookie-params.php
  944. **/
  945. static function session_get_cookie_params() : NativeAssocArray<Dynamic>;
  946. /**
  947. @see http://php.net/manual/en/function.session-set-save-handler.php
  948. **/
  949. @:overload(function( sessionhandler:SessionHandlerInterface, register_shutdown:Bool = true ) : Bool {})
  950. static function session_set_save_handler( open:String->String->Bool, close:Void->Bool, read:String->String, write:String->String->Bool, destroy:String->Bool, gc:Int->Bool, ?create_sid:Void->String, ?validate_sid:Function, ?update_timestamp:Function ) : Bool;
  951. /**
  952. @see http://php.net/manual/en/function.mail.php
  953. **/
  954. static function mail( to:String, subject:String, message:String, ?additional_headers:String, ?additional_parameters:String ) : Bool;
  955. /**
  956. @see http://php.net/manual/en/function.require.php
  957. **/
  958. static function require( include_path:String ) : Void;
  959. /**
  960. @see http://php.net/manual/en/function.require-once.php
  961. **/
  962. static function require_once( include_path:String ) : Void;
  963. /**
  964. @see http://php.net/manual/en/function.include.php
  965. **/
  966. static function include( include_path:String ) : Void;
  967. /**
  968. @see http://php.net/manual/en/function.include-once.php
  969. **/
  970. static function include_once( include_path:String ) : Void;
  971. /**
  972. @see http://php.net/manual/en/function.gzcompress.php
  973. **/
  974. static function gzcompress( data:String, ?level:Int, ?encoding:Int ) : EitherType<String,Bool>;
  975. /**
  976. @see http://php.net/manual/en/function.gzuncompress.php
  977. **/
  978. static function gzuncompress( data:String, ?length:Int ) : EitherType<String,Bool>;
  979. /**
  980. @see http://php.net/manual/en/function.move-uploaded-file.php
  981. **/
  982. static function move_uploaded_file( filename:String, destination:String ) : Bool;
  983. /**
  984. @see http://php.net/manual/en/function.is-uploaded-file.php
  985. **/
  986. static function is_uploaded_file( filename:String ) : Bool;
  987. }