Global.hx 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  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.in-array.php
  186. **/
  187. static function in_array( needle:Dynamic, haystack:NativeArray, strict:Bool = false ) : Bool ;
  188. /**
  189. @see http://php.net/manual/en/function.usort.php
  190. **/
  191. static function usort( array:Ref<NativeArray>, value_compare_func:Dynamic->Dynamic->Int ) : Bool ;
  192. /**
  193. @see http://php.net/manual/en/function.reset.php
  194. **/
  195. static function reset( array:Ref<NativeArray> ) : Dynamic;
  196. /**
  197. @see http://php.net/manual/en/function.current.php
  198. **/
  199. static function current( array:Ref<NativeArray> ) : Dynamic;
  200. /**
  201. @see http://php.net/manual/en/function.next.php
  202. **/
  203. static function next( array:Ref<NativeArray> ) : Dynamic;
  204. /**
  205. @see http://php.net/manual/en/function.prev.php
  206. **/
  207. static function prev( array:Ref<NativeArray> ) : Dynamic;
  208. /**
  209. @see http://php.net/manual/en/function.end.php
  210. **/
  211. static function end( array:Ref<NativeArray> ) : Dynamic;
  212. /**
  213. @see http://php.net/manual/en/function.key.php
  214. **/
  215. static function key( array:NativeArray ) : EitherType<String,Int>;
  216. /**
  217. @see http://php.net/manual/en/function.each.php
  218. **/
  219. static function each( array:Ref<NativeArray> ) : NativeArray;
  220. /**
  221. @see http://php.net/manual/en/function.defined.php
  222. **/
  223. static function defined( name:String ) : Bool;
  224. /**
  225. @see http://php.net/manual/en/function.define.php
  226. **/
  227. static function define( name:String, value:Dynamic, case_insensitive:Bool = false ) : Bool;
  228. /**
  229. @see http://php.net/manual/en/function.echo.php
  230. **/
  231. static function echo( args:Rest<String> ) : Void;
  232. /**
  233. @see http://php.net/manual/en/function.sprintf.php
  234. **/
  235. static function sprintf( format:String, args:Rest<Dynamic> ) : EitherType<String,Bool>;
  236. /**
  237. @see http://php.net/manual/en/function.method-exists.php
  238. **/
  239. static function method_exists( object:Dynamic, method_name:String ) : Bool;
  240. /**
  241. @see http://php.net/manual/en/function.property-exists.php
  242. **/
  243. static function property_exists( object:Dynamic, property_name:String ) : Bool;
  244. /**
  245. @see http://php.net/manual/en/function.is-callable.php
  246. **/
  247. static function is_callable( value:Dynamic, syntax_only:Bool = false, ?callable_name:String ) : Bool;
  248. /**
  249. @see http://php.net/manual/en/function.isset.php
  250. **/
  251. static function isset( value:Dynamic, args:Rest<Dynamic> ) : Bool;
  252. /**
  253. @see http://php.net/manual/en/function.unset.php
  254. **/
  255. static function unset( value:Dynamic, values:Rest<Dynamic> ) : Void;
  256. /**
  257. @see http://php.net/manual/en/function.get-object-vars.php
  258. **/
  259. static function get_object_vars( object:{} ) : NativeAssocArray<Dynamic>;
  260. /**
  261. @see http://php.net/manual/en/function.get-class.php
  262. **/
  263. static function get_class( object:{} = null ) : EitherType<Bool,String>;
  264. /**
  265. @see http://php.net/manual/en/function.get-parent-class.php
  266. **/
  267. static function get_parent_class( ?object:Dynamic ) : EitherType<Bool,String>;
  268. /**
  269. @see http://php.net/manual/en/function.var-dump.php
  270. **/
  271. static function var_dump( args:Rest<Dynamic> ) : Void;
  272. /**
  273. @see http://php.net/manual/en/function.ord.php
  274. **/
  275. static function ord( string:String ) : Int;
  276. /**
  277. @see http://php.net/manual/en/function.chr.php
  278. **/
  279. static function chr( code:Int ) : String;
  280. /**
  281. @see http://php.net/manual/en/function.strpos.php
  282. **/
  283. static function strpos( haystack:String, needle:String, offset:Int = 0 ) : EitherType<Bool, Int>;
  284. /**
  285. @see http://php.net/manual/en/function.strrpos.php
  286. **/
  287. static function strrpos( haystack:String, needle:String, offset:Int = 0 ) : EitherType<Bool, Int>;
  288. /**
  289. @see http://php.net/manual/en/function.str-split.php
  290. **/
  291. static function str_split( string:String, split_length:Int = 1 ) : EitherType<Bool,NativeIndexedArray<String>>;
  292. /**
  293. @see http://php.net/manual/en/function.strlen.php
  294. **/
  295. static function strlen( string:String ) : Int;
  296. /**
  297. @see http://php.net/manual/en/function.strcmp.php
  298. **/
  299. static function strcmp( str1:String, str2:String ) : Int;
  300. /**
  301. @see http://php.net/manual/en/function.str-repeat.php
  302. **/
  303. static function str_repeat( input:String, multiplier:Int ) : String;
  304. /**
  305. @see http://php.net/manual/en/function.str-replace.php
  306. **/
  307. static function str_replace( search:EitherType<String,NativeArray>, replace:EitherType<String,NativeArray>, subject:EitherType<String,NativeArray>, ?count:Int ) : EitherType<String,NativeArray>;
  308. /**
  309. @see http://php.net/manual/en/function.explode.php
  310. **/
  311. static function explode( delimiter:String, string:String, ?limit:Int ) : EitherType<Bool,NativeIndexedArray<String>>;
  312. /**
  313. @see http://php.net/manual/en/function.substr.php
  314. **/
  315. static function substr( string:String, start:Int, ?length:Int ) : EitherType<Bool,String>;
  316. /**
  317. @see http://php.net/manual/en/function.substr_replace.php
  318. **/
  319. static function substr_replace( string:EitherType<String,NativeArray>, replacement:EitherType<String,NativeArray>, start:EitherType<Int,NativeArray>, ?length:EitherType<Int,NativeArray> ) : EitherType<String,NativeArray>;
  320. /**
  321. @see http://php.net/manual/en/function.strtoupper.php
  322. **/
  323. static function strtoupper( string:String ) : String;
  324. /**
  325. @see http://php.net/manual/en/function.strtolower.php
  326. **/
  327. static function strtolower( string:String ) : String;
  328. /**
  329. @see http://php.net/manual/en/function.debug-backtrace.php
  330. **/
  331. static function debug_backtrace( ?options:Int, ?limit:Int ) : NativeIndexedArray<NativeAssocArray<Dynamic>>;
  332. /**
  333. @see http://php.net/manual/en/function.call-user-func.php
  334. **/
  335. static function call_user_func( callback:Dynamic, arguments:Rest<Dynamic> ) : Dynamic;
  336. /**
  337. @see http://php.net/manual/en/function.call-user-func-array.php
  338. **/
  339. static function call_user_func_array( callback:Dynamic, arguments:NativeArray ) : Dynamic;
  340. /**
  341. @see http://php.net/manual/en/function.func-get-args.php
  342. **/
  343. static function func_get_args() : NativeIndexedArray<Dynamic>;
  344. /**
  345. @see http://php.net/manual/en/function.abs.php
  346. **/
  347. static function abs<T:Float>( number:T ) : T;
  348. /**
  349. @see http://php.net/manual/en/function.min.php
  350. **/
  351. static function min( values:Rest<Dynamic> ) : Dynamic;
  352. /**
  353. @see http://php.net/manual/en/function.max.php
  354. **/
  355. static function max( values:Rest<Dynamic> ) : Dynamic;
  356. /**
  357. @see http://php.net/manual/en/function.sin.php
  358. **/
  359. static function sin( arg:Float ) : Float;
  360. /**
  361. @see http://php.net/manual/en/function.cos.php
  362. **/
  363. static function cos( arg:Float ) : Float;
  364. /**
  365. @see http://php.net/manual/en/function.atan2.php
  366. **/
  367. static function atan2( y:Float, x:Float ) : Float;
  368. /**
  369. @see http://php.net/manual/en/function.tan.php
  370. **/
  371. static function tan( arg:Float ) : Float;
  372. /**
  373. @see http://php.net/manual/en/function.exp.php
  374. **/
  375. static function exp( arg:Float ) : Float;
  376. /**
  377. @see http://php.net/manual/en/function.log.php
  378. **/
  379. static function log( arg:Float ) : Float;
  380. /**
  381. @see http://php.net/manual/en/function.sqrt.php
  382. **/
  383. static function sqrt( arg:Float ) : Float;
  384. /**
  385. @see http://php.net/manual/en/function.floor.php
  386. **/
  387. static function floor( arg:Float ) : Float;
  388. /**
  389. @see http://php.net/manual/en/function.ceil.php
  390. **/
  391. static function ceil( arg:Float ) : Float;
  392. /**
  393. @see http://php.net/manual/en/function.round.php
  394. **/
  395. static function round( val:Float, precision:Int = 0, ?mode:Int ) : Float;
  396. /**
  397. @see http://php.net/manual/en/function.atan.php
  398. **/
  399. static function atan( arg:Float ) : Float;
  400. /**
  401. @see http://php.net/manual/en/function.asin.php
  402. **/
  403. static function asin( arg:Float ) : Float;
  404. /**
  405. @see http://php.net/manual/en/function.acos.php
  406. **/
  407. static function acos( arg:Float ) : Float;
  408. /**
  409. @see http://php.net/manual/en/function.pow.php
  410. **/
  411. static function pow( base:Float, exp:Float ) : Float;
  412. /**
  413. @see http://php.net/manual/en/function.mt-rand.php
  414. **/
  415. @:overload(function() : Int {})
  416. static function mt_rand( base:Int, exp:Int ) : Int;
  417. /**
  418. @see http://php.net/manual/en/function.mt-getrandmax.php
  419. **/
  420. static function mt_getrandmax() : Int;
  421. /**
  422. @see http://php.net/manual/en/function.is-nan.php
  423. **/
  424. static function is_nan( arg:Float ) : Bool;
  425. /**
  426. @see http://php.net/manual/en/function.is-finite.php
  427. **/
  428. static function is_finite( arg:Float ) : Bool;
  429. /**
  430. @see http://php.net/manual/en/function.trim.php
  431. **/
  432. static function trim( str:String, ?character_mask:String ) : String;
  433. /**
  434. @see http://php.net/manual/en/function.rtrim.php
  435. **/
  436. static function rtrim( str:String, ?character_mask:String ) : String;
  437. /**
  438. @see http://php.net/manual/en/function.ltrim.php
  439. **/
  440. static function ltrim( str:String, ?character_mask:String ) : String;
  441. /**
  442. @see http://php.net/manual/en/function.getenv.php
  443. **/
  444. static function getenv( varname:String ) : EitherType<String,Bool>;
  445. /**
  446. @see http://php.net/manual/en/function.putenv.php
  447. **/
  448. static function putenv( setting:String ) : Bool;
  449. /**
  450. @see http://php.net/manual/en/function.sleep.php
  451. **/
  452. static function sleep( seconds:Int ) : EitherType<Bool,Int>;
  453. /**
  454. @see http://php.net/manual/en/function.usleep.php
  455. **/
  456. static function usleep( micro_seconds:Int ) : Void;
  457. /**
  458. @see http://php.net/manual/en/function.setlocale.php
  459. **/
  460. @:overload(function( category:Int, locale:NativeIndexedArray<String> ) : EitherType<Bool,String> {})
  461. static function setlocale( category:Int, locale:Rest<String> ) : EitherType<Bool,String>;
  462. /**
  463. @see http://php.net/manual/en/function.getcwd.php
  464. **/
  465. static function getcwd() : EitherType<String,Bool>;
  466. /**
  467. @see http://php.net/manual/en/function.chdir.php
  468. **/
  469. static function chdir( directory:String ) : Bool;
  470. /**
  471. @see http://php.net/manual/en/function.php-uname.php
  472. **/
  473. static function php_uname( mode:String = 'a' ) : String;
  474. /**
  475. @see http://php.net/manual/en/function.system.php
  476. **/
  477. static function system( command:String, ?return_var:Ref<Int> ) : EitherType<String,Bool>;
  478. /**
  479. @see http://php.net/manual/en/function.microtime.php
  480. **/
  481. static function microtime( get_as_float:Bool = false ) : EitherType<Float,String>;
  482. /**
  483. @see http://php.net/manual/en/function.fopen.php
  484. **/
  485. static function fopen( filename:String, mode:String, use_include_path:Bool = false, ?context:Resource ) : EitherType<Bool,Resource>;
  486. /**
  487. @see http://php.net/manual/en/function.fclose.php
  488. **/
  489. static function fclose( handle:Resource ) : Bool;
  490. /**
  491. @see http://php.net/manual/en/function.feof.php
  492. **/
  493. static function feof( handle:Resource ) : Bool;
  494. /**
  495. @see http://php.net/manual/en/function.fseek.php
  496. **/
  497. static function fseek( handle:Resource, offset:Int, ?whence:Int ) : EitherType<Int,Bool>;
  498. /**
  499. @see http://php.net/manual/en/function.ftell.php
  500. **/
  501. static function ftell( handle:Resource ) : EitherType<Int,Bool>;
  502. /**
  503. @see http://php.net/manual/en/function.rewind.php
  504. **/
  505. static function rewind( handle:Resource ) : Bool;
  506. /**
  507. @see http://php.net/manual/en/function.fgetc.php
  508. **/
  509. static function fgetc( handle:Resource ) : EitherType<Bool,String>;
  510. /**
  511. @see http://php.net/manual/en/function.fgets.php
  512. **/
  513. static function fgets( handle:Resource ) : EitherType<Bool,String>;
  514. /**
  515. @see http://php.net/manual/en/function.fflush.php
  516. **/
  517. static function fflush( handle:Resource ) : Bool;
  518. /**
  519. @see http://php.net/manual/en/function.fwrite.php
  520. **/
  521. static function fwrite( handle:Resource, string:String, ?length:Int ) : EitherType<Int,Bool>;
  522. /**
  523. @see http://php.net/manual/en/function.fread.php
  524. **/
  525. static function fread( handle:Resource, length:Int ) : EitherType<Bool,String>;
  526. /**
  527. @see http://php.net/manual/en/function.file-exists.php
  528. **/
  529. static function file_exists( filename:String ) : Bool;
  530. /**
  531. @see http://php.net/manual/en/function.file-get-contents.php
  532. **/
  533. static function file_get_contents( filename:String, use_include_path:Bool = false, ?context:Resource, offset:Int = 0, ?maxlen:Int ) : EitherType<String,Bool>;
  534. /**
  535. @see http://php.net/manual/en/function.file-put-contents.php
  536. **/
  537. static function file_put_contents( filename:String, data:Dynamic, flags:Int = 0, ?context:Resource ) : EitherType<Int,Bool>;
  538. /**
  539. @see http://php.net/manual/en/function.clearstatcache.php
  540. **/
  541. static function clearstatcache( clear_realpath_cache:Bool = false, ?filename:String ) : Bool;
  542. /**
  543. @see http://php.net/manual/en/function.fstat.php
  544. **/
  545. static function fstat( handle:Resource ) : NativeArray;
  546. /**
  547. @see http://php.net/manual/en/function.stat.php
  548. **/
  549. static function stat( filename:String ) : EitherType<NativeArray,Bool>;
  550. /**
  551. @see http://php.net/manual/en/function.realpath.php
  552. **/
  553. static function realpath( path:String ) : EitherType<String,Bool>;
  554. /**
  555. @see http://php.net/manual/en/function.filetype.php
  556. **/
  557. static function filetype( filename:String ) : EitherType<String,Bool>;
  558. /**
  559. @see http://php.net/manual/en/function.mkdir.php
  560. **/
  561. static function mkdir( pathname:String, mode:Int = 511, recursive:Bool = false, ?context:Resource ) : Bool;
  562. /**
  563. @see http://php.net/manual/en/function.unlink.php
  564. **/
  565. static function unlink( filename:String, ?context:Resource ) : Bool;
  566. /**
  567. @see http://php.net/manual/en/function.rmdir.php
  568. **/
  569. static function rmdir( dirname:String, ?context:Resource ) : Bool;
  570. /**
  571. @see http://php.net/manual/en/function.dirname.php
  572. **/
  573. static function dirname( path:String, levels:Int = 1 ) : String;
  574. /**
  575. @see http://php.net/manual/en/function.glob.php
  576. **/
  577. static function glob( pattern:String, flags:Int = 0 ) : NativeArray;
  578. /**
  579. @see http://php.net/manual/en/function.opendir.php
  580. **/
  581. static function opendir( path:String, ?context:Resource ) : EitherType<Resource,Bool>;
  582. /**
  583. @see http://php.net/manual/en/function.closedir.php
  584. **/
  585. static function closedir( dir_handle:Resource ) : Void;
  586. /**
  587. @see http://php.net/manual/en/function.readdir.php
  588. **/
  589. static function readdir( ?dir_handle:Resource ) : EitherType<String,Bool>;
  590. /**
  591. @see http://php.net/manual/en/function.rewinddir.php
  592. **/
  593. static function rewinddir( ?dir_handle:Resource ) : Void;
  594. /**
  595. @see http://php.net/manual/en/function.is-dir.php
  596. **/
  597. static function is_dir( filename:String ) : Bool;
  598. /**
  599. @see http://php.net/manual/en/function.rename.php
  600. **/
  601. static function rename( oldname:String, newname:String, ?context:Resource ) : Bool;
  602. /**
  603. @see http://php.net/manual/en/function.copy.php
  604. **/
  605. static function copy( source:String, dest:String, ?context:Resource ) : Bool;
  606. /**
  607. @see http://php.net/manual/en/function.preg-match.php
  608. **/
  609. static function preg_match( pattern:String, subject:String, ?matches:NativeArray, ?flags:Int, ?offset:Int ) : EitherType<Bool,Int> ;
  610. /**
  611. @see http://php.net/manual/en/function.preg-match-all.php
  612. **/
  613. static function preg_match_all( pattern:String, subject:String, ?matches:NativeArray, ?flags:Int, ?offset:Int ) : EitherType<Bool,Int> ;
  614. /**
  615. @see http://php.net/manual/en/function.preg-quote.php
  616. **/
  617. static function preg_quote( str:String, ?delimiter:String ) : String;
  618. /**
  619. @see http://php.net/manual/en/function.preg-split.php
  620. **/
  621. static function preg_split( pattern:String, subject:String, limit:Int = -1, flags:Int = 0 ) : EitherType<Bool,NativeArray> ;
  622. /**
  623. @see http://php.net/manual/en/function.preg-replace.php
  624. **/
  625. static function preg_replace( pattern:EitherType<String,NativeArray>, replacement:EitherType<String,NativeArray>, subject:EitherType<String,NativeArray>, limit:Int = -1, ?count:Int ) : EitherType<String,NativeArray> ;
  626. /**
  627. @see http://php.net/manual/en/function.md5.php
  628. **/
  629. static function md5( str:String, raw_output:Bool = false ) : String;
  630. /**
  631. @see http://php.net/manual/en/function.sha1.php
  632. **/
  633. static function sha1( str:String, raw_output:Bool = false ) : String;
  634. /**
  635. @see http://php.net/manual/en/function.hash.php
  636. **/
  637. static function hash( algo:String, str:String, raw_output:Bool = false ) : String;
  638. /**
  639. @see http://php.net/manual/en/function.pack.php
  640. **/
  641. static function pack( format:String, args:Rest<Dynamic> ) : String;
  642. /**
  643. @see http://php.net/manual/en/function.unpack.php
  644. **/
  645. static function unpack( format:String, data:String ) : NativeArray;
  646. /**
  647. @see http://php.net/manual/en/function.chunk-split.php
  648. **/
  649. static function chunk_split( body:String, chunklen:Int = 76, end:String = "\r\n" ) : String;
  650. /**
  651. @see http://php.net/manual/en/function.urlencode.php
  652. **/
  653. static function urlencode( str:String ) : String;
  654. /**
  655. @see http://php.net/manual/en/function.urldecode.php
  656. **/
  657. static function urldecode( str:String ) : String;
  658. /**
  659. @see http://php.net/manual/en/function.rawurlencode.php
  660. **/
  661. static function rawurlencode( str:String ) : String;
  662. /**
  663. @see http://php.net/manual/en/function.rawurldecode.php
  664. **/
  665. static function rawurldecode( str:String ) : String;
  666. /**
  667. @see http://php.net/manual/en/function.header.php
  668. **/
  669. static function header( string:String, replace:Bool = true, ?http_response_code:Int ) : Void;
  670. /**
  671. @see http://php.net/manual/en/function.setcookie.php
  672. **/
  673. static function setcookie( name:String, value:String = "", expire:Int = 0, path:String = "", domain:String = "", secure:Bool = false, httponly:Bool = false ) : Bool;
  674. /**
  675. @see http://php.net/manual/en/function.htmlspecialchars.php
  676. **/
  677. static function htmlspecialchars( string:String, ?flags:Int, ?encoding:String, double_encode:Bool = true ) : String;
  678. /**
  679. @see http://php.net/manual/en/function.htmlspecialchars_decode.php
  680. **/
  681. static function htmlspecialchars_decode( string:String, ?flags:Int ) : String;
  682. /**
  683. @see http://php.net/manual/en/function.str-pad.php
  684. **/
  685. static function str_pad( input:String, pad_length:Int, pad_String:String = ' ', ?pad_type:Int ) : String;
  686. /**
  687. @see http://php.net/manual/en/function.dechex.php
  688. **/
  689. static function dechex( number:Int ) : String;
  690. /**
  691. @see http://php.net/manual/en/function.hexdec.php
  692. **/
  693. static function hexdec( hex_string:String ) : Int;
  694. /**
  695. @see http://php.net/manual/en/function.bin2hex.php
  696. **/
  697. static function bin2hex( str:String ) : String;
  698. /**
  699. @see http://php.net/manual/en/function.hex2bin.php
  700. **/
  701. static function hex2bin( str:String ) : EitherType<String,Bool>;
  702. /**
  703. @see http://php.net/manual/en/function.serialize.php
  704. **/
  705. static function serialize( value:Dynamic ) : String;
  706. /**
  707. @see http://php.net/manual/en/function.unserialize.php
  708. **/
  709. static function unserialize( str:String, ?options:NativeArray ) : Dynamic;
  710. /**
  711. @see http://php.net/manual/en/function.extension-loaded.php
  712. **/
  713. static function extension_loaded( name:String ) : Bool;
  714. /**
  715. @see http://php.net/manual/en/function.strncasecmp.php
  716. **/
  717. static function strncasecmp( str1:String, str2:String, len:Int ) : Int;
  718. /**
  719. @see http://php.net/manual/en/function.strcasecmp.php
  720. **/
  721. static function strcasecmp( str1:String, str2:String ) : Int;
  722. /**
  723. @see http://php.net/manual/en/function.fpassthru.php
  724. **/
  725. static function fpassthru( handle:Resource ) : Int;
  726. /**
  727. @see http://php.net/manual/en/function.json-encode.php
  728. **/
  729. static function json_encode( value:Dynamic, options:Int = 0, depth:Int = 512 ) : EitherType<String,Bool>;
  730. /**
  731. @see http://php.net/manual/en/function.json-decode.php
  732. **/
  733. static function json_decode( json:String, assoc:Bool = false, depth:Int = 512, options:Int = 512 ) : Dynamic;
  734. /**
  735. @see http://php.net/manual/en/function.json-last-error.php
  736. **/
  737. static function json_last_error() : Int;
  738. /**
  739. @see http://php.net/manual/en/function.json-last-error-msg.php
  740. **/
  741. static function json_last_error_msg() : EitherType<String,Bool>;
  742. /**
  743. @see http://php.net/manual/en/function.spl-object-hash.php
  744. **/
  745. static function spl_object_hash( obj:{} ) : String;
  746. /**
  747. @see http://php.net/manual/en/function.utf8-encode.php
  748. **/
  749. static function utf8_encode( data:String ) : String;
  750. /**
  751. @see http://php.net/manual/en/function.utf8-decode.php
  752. **/
  753. static function utf8_decode( data:String ) : String;
  754. /**
  755. @see http://php.net/manual/en/function.mb-convert-encoding.php
  756. **/
  757. static function mb_convert_encoding( str:String, to_encoding:String, ?from_encoding:Dynamic ) : String;
  758. /**
  759. @see http://php.net/manual/en/function.mb-check-encoding.php
  760. **/
  761. static function mb_check_encoding( str:String = null, ?encoding:String ) : Bool;
  762. /**
  763. @see http://php.net/manual/en/function.mb-strlen.php
  764. **/
  765. static function mb_strlen( str:String, ?encoding:String ) : EitherType<Int,Bool>;
  766. /**
  767. @see http://php.net/manual/en/function.mb-substr.php
  768. **/
  769. static function mb_substr( str:String, start:Int, length:Int = null, ?encoding:String ) : String;
  770. /**
  771. @see http://php.net/manual/en/function.proc-open.php
  772. **/
  773. static function proc_open( cmd:String, descriptorspec:NativeArray, pipes:NativeIndexedArray<Resource>, ?cwd:String, ?env:NativeArray, ?other_options:NativeArray ) : EitherType<Resource,Bool>;
  774. /**
  775. @see http://php.net/manual/en/function.proc-get-status.php
  776. **/
  777. static function proc_get_status( process:Resource ) : EitherType<Bool,NativeAssocArray<Scalar>>;
  778. /**
  779. @see http://php.net/manual/en/function.proc-close.php
  780. **/
  781. static function proc_close( process:Resource ) : Int;
  782. /**
  783. @see http://php.net/manual/en/function.proc-terminate.php
  784. **/
  785. static function proc_terminate( process:Resource, signal:Int = 15 ) : Bool;
  786. /**
  787. @see http://php.net/manual/en/function.stream-select.php
  788. **/
  789. static function stream_select( read:NativeArray, write:NativeArray, except:NativeArray, tv_sec:Int, tv_usec:Int = 0 ) : Bool;
  790. /**
  791. @see http://php.net/manual/en/function.stream-socket-shutdown.php
  792. **/
  793. static function stream_socket_shutdown( stream:Resource, how:Int ) : Bool;
  794. /**
  795. @see http://php.net/manual/en/function.stream-set-timeout.php
  796. **/
  797. static function stream_set_timeout( stream:Resource, seconds:Int, microseconds:Int = 0 ) : Bool;
  798. /**
  799. @see http://php.net/manual/en/function.stream-set-blocking.php
  800. **/
  801. static function stream_set_blocking( stream:Resource, mode:Bool ) : Bool;
  802. /**
  803. @see http://php.net/manual/en/function.stream-socket-accept.php
  804. **/
  805. static function stream_socket_accept( server_socket:Resource, ?timeout:Float, ?peername:Ref<String> ) : EitherType<Resource,Bool>;
  806. /**
  807. @see http://php.net/manual/en/function.stream-socket-client.php
  808. **/
  809. static function stream_socket_client( remote_socket:String, ?errno:Ref<Int>, ?errstr:Ref<String>, ?timeout:Float, ?flags:Int, ?context:Resource ) : EitherType<Resource,Bool>;
  810. /**
  811. @see http://php.net/manual/en/function.stream-socket-server.php
  812. **/
  813. static function stream_socket_server( local_socket:String, ?errno:Ref<Int>, ?errstr:Ref<String>, ?flags:Int, ?context:Resource ) : EitherType<Resource,Bool>;
  814. /**
  815. @see http://php.net/manual/en/function.stream-socket-get-name.php
  816. **/
  817. static function stream_socket_get_name( stream:Resource, want_peer:Bool ) : EitherType<String,Bool>;
  818. /**
  819. @see http://php.net/manual/en/function.ini-get.php
  820. **/
  821. static function ini_get( var_name:String ) : EitherType<Bool,String>;
  822. /**
  823. @see http://php.net/manual/en/function.ini-set.php
  824. **/
  825. static function ini_set( var_name:String, newvalue:String ) : EitherType<Bool,String>;
  826. /**
  827. @see http://php.net/manual/en/function.sqlite-error-string.php
  828. **/
  829. static function sqlite_error_string( error_code:Int ) : String;
  830. /**
  831. @see http://php.net/manual/en/function.sqlite-escape-string.php
  832. **/
  833. static function sqlite_escape_string( item:String ) : String;
  834. /**
  835. @see http://php.net/manual/en/function.set-time-limit.php
  836. **/
  837. static function set_time_limit( seconds:Int ) : Bool;
  838. /**
  839. @see http://php.net/manual/en/function.function-exists.php
  840. **/
  841. static function function_exists( function_name:String ) : Bool;
  842. /**
  843. @see http://php.net/manual/en/function.getallheaders.php
  844. **/
  845. static function getallheaders() : NativeAssocArray<Dynamic>;
  846. /**
  847. @see http://php.net/manual/en/function.ucwords.php
  848. **/
  849. static function ucwords( str:String, ?delimiters:String ) : String;
  850. /**
  851. @see http://php.net/manual/en/function.base64-encode.php
  852. **/
  853. static function base64_encode( data:String ) : EitherType<String,Bool>;
  854. /**
  855. @see http://php.net/manual/en/function.base64-decode.php
  856. **/
  857. static function base64_decode( data:String, strict:Bool = false ) : EitherType<String,Bool>;
  858. /**
  859. @see http://php.net/manual/en/function.gethostbyname.php
  860. **/
  861. static function gethostbyname( hostname:String ) : String;
  862. /**
  863. @see http://php.net/manual/en/function.gethostbyaddr.php
  864. **/
  865. static function gethostbyaddr( ip_address:String ) : EitherType<String,Bool>;
  866. /**
  867. @see http://php.net/manual/en/function.getprotobyname.php
  868. **/
  869. static function getprotobyname( name:String ) : EitherType<Int,Bool>;
  870. /**
  871. @see http://php.net/manual/en/function.mktime.php
  872. **/
  873. static function mktime( ?hour:Int, ?minute:Int, ?second:Int, ?month:Int, ?day:Int, ?year:Int, ?is_dst:Int ) : EitherType<Int,Bool>;
  874. /**
  875. @see http://php.net/manual/en/function.date.php
  876. **/
  877. static function date( format:String, ?timestamp:Int ) : EitherType<String,Bool>;
  878. /**
  879. @see http://php.net/manual/en/function.strtotime.php
  880. **/
  881. static function strtotime( time:String, ?now:Int ) : EitherType<Int,Bool>;
  882. /**
  883. @see http://php.net/manual/en/function.flush.php
  884. **/
  885. static function flush() : Void;
  886. /**
  887. @see http://php.net/manual/en/function.session-cache-limiter.php
  888. **/
  889. static function session_cache_limiter( ?cache_limiter:String ) : String;
  890. /**
  891. @see http://php.net/manual/en/function.session-cache-expire.php
  892. **/
  893. static function session_cache_expire( ?new_cache_expire:Int ) : Int;
  894. /**
  895. @see http://php.net/manual/en/function.session-name.php
  896. **/
  897. static function session_name( ?name:String ) : String;
  898. /**
  899. @see http://php.net/manual/en/function.session-start.php
  900. **/
  901. static function session_start( ?options:NativeArray ) : Bool;
  902. /**
  903. @see http://php.net/manual/en/function.session-unset.php
  904. **/
  905. static function session_unset() : Void;
  906. /**
  907. @see http://php.net/manual/en/function.session-write-close.php
  908. **/
  909. static function session_write_close() : Void;
  910. /**
  911. @see http://php.net/manual/en/function.session-id.php
  912. **/
  913. static function session_id( ?id:String ) : String;
  914. /**
  915. @see http://php.net/manual/en/function.session-save-path.php
  916. **/
  917. static function session_save_path( ?path:String ) : String;
  918. /**
  919. @see http://php.net/manual/en/function.session-module-name.php
  920. **/
  921. static function session_module_name( ?module:String ) : String;
  922. /**
  923. @see http://php.net/manual/en/function.session-regenerate-id.php
  924. **/
  925. static function session_regenerate_id( delete_old_session:Bool = false ) : Bool;
  926. /**
  927. @see http://php.net/manual/en/function.session-set-cookie-params.php
  928. **/
  929. static function session_set_cookie_params( lifetime:Int, ?path:String, ?domain:String, secure:Bool = false, httponly:Bool = false ) : Bool;
  930. /**
  931. @see http://php.net/manual/en/function.session-get-cookie-params.php
  932. **/
  933. static function session_get_cookie_params() : NativeAssocArray<Dynamic>;
  934. /**
  935. @see http://php.net/manual/en/function.session-set-save-handler.php
  936. **/
  937. @:overload(function( sessionhandler:SessionHandlerInterface, register_shutdown:Bool = true ) : Bool {})
  938. 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;
  939. /**
  940. @see http://php.net/manual/en/function.mail.php
  941. **/
  942. static function mail( to:String, subject:String, message:String, ?additional_headers:String, ?additional_parameters:String ) : Bool;
  943. /**
  944. @see http://php.net/manual/en/function.require.php
  945. **/
  946. static function require( include_path:String ) : Void;
  947. /**
  948. @see http://php.net/manual/en/function.require-once.php
  949. **/
  950. static function require_once( include_path:String ) : Void;
  951. /**
  952. @see http://php.net/manual/en/function.include.php
  953. **/
  954. static function include( include_path:String ) : Void;
  955. /**
  956. @see http://php.net/manual/en/function.include-once.php
  957. **/
  958. static function include_once( include_path:String ) : Void;
  959. }