PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/library/php/FirePHP.hx

https://code.google.com/p/haxe-firephp/
Haxe | 293 lines | 52 code | 45 blank | 196 comment | 0 complexity | b9e114aa86ad97f4d7911a676d1427ed MD5 | raw file
  1. package php;
  2. @:native("FirePHP") extern class FirePHP
  3. {
  4. static function __init__() : Void
  5. {
  6. untyped __php__("require_once 'php/FirePHP.php';");
  7. }
  8. /**
  9. * FirePHP version
  10. */
  11. static inline public var VERSION : String = '0.3'; // @pinf replace '0.3' with '%%package.version%%'
  12. /**
  13. * Firebug LOG level
  14. * Logs a message to firebug console.
  15. */
  16. static inline public var LOG : String = 'LOG';
  17. /**
  18. * Firebug INFO level
  19. * Logs a message to firebug console and displays an info icon before the message.
  20. */
  21. static inline public var INFO : String = 'INFO';
  22. /**
  23. * Firebug WARN level
  24. * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.
  25. */
  26. static inline public var WARN : String = 'WARN';
  27. /**
  28. * Firebug ERROR level
  29. * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
  30. */
  31. static inline public var ERROR : String = 'ERROR';
  32. /**
  33. * Dumps a variable to firebug's server panel
  34. */
  35. static inline public var DUMP : String = 'DUMP';
  36. /**
  37. * Displays a stack trace in firebug console
  38. */
  39. static inline public var TRACE : String = 'TRACE';
  40. /**
  41. * Displays an exception in firebug console
  42. * Increments the firebug error count.
  43. */
  44. static inline public var EXCEPTION : String = 'EXCEPTION';
  45. /**
  46. * Displays an table in firebug console
  47. */
  48. static inline public var TABLE : String = 'TABLE';
  49. /**
  50. * Starts a group in firebug console
  51. */
  52. static inline public var GROUP_START : String = 'GROUP_START';
  53. /**
  54. * Ends a group in firebug console
  55. */
  56. static inline public var GROUP_END : String = 'GROUP_END';
  57. /**
  58. * When the object gets serialized only include specific object members.
  59. */
  60. public function __sleep() : NativeArray;
  61. /**
  62. * Gets singleton instance of FirePHP
  63. */
  64. public static function getInstance(AutoCreate:Bool=false) : FirePHP;
  65. /**
  66. * Creates FirePHP object and stores it for singleton access
  67. */
  68. public static function init() : FirePHP;
  69. /**
  70. * Set the instance of the FirePHP singleton
  71. * @param instance The FirePHP object instance
  72. */
  73. public static function setInstance(instance:FirePHP) : FirePHP;
  74. /**
  75. * Set an Insight console to direct all logging calls to
  76. * @param console The console object to log to
  77. */
  78. public function setLogToInsightConsole(console:Dynamic) : Void;
  79. /**
  80. * Enable and disable logging to Firebug
  81. * @param Enabled TRUE to enable, FALSE to disable
  82. */
  83. public function setEnabled(Enabled:Bool) : Void;
  84. /**
  85. * Check if logging is enabled
  86. * @return boolean TRUE if enabled
  87. */
  88. public function getEnabled() : Bool;
  89. /**
  90. * Specify a filter to be used when encoding an object
  91. * Filters are used to exclude object members.
  92. * @param Class The class name of the object
  93. * @param Filter An array of members to exclude
  94. */
  95. public function setObjectFilter(Class:String, Filter:NativeArray) : Void;
  96. /**
  97. * Set some options for the library
  98. * Options:
  99. * - maxDepth: The maximum depth to traverse (default: 10)
  100. * - maxObjectDepth: The maximum depth to traverse objects (default: 5)
  101. * - maxArrayDepth: The maximum depth to traverse arrays (default: 5)
  102. * - useNativeJsonEncode: If true will use json_encode() (default: true)
  103. * - includeLineNumbers: If true will include line numbers and filenames (default: true)
  104. * @param Options The options to be set
  105. */
  106. public function setOptions(Options:NativeArray) : Void;
  107. /**
  108. * Get options from the library
  109. * @return array The currently set options
  110. */
  111. public function getOptions() : NativeArray;
  112. /**
  113. * Set an option for the library
  114. * @throws Exception
  115. */
  116. public function setOption(Name:String, Value:Dynamic) : Void;
  117. /**
  118. * Get an option from the library
  119. * @throws Exception
  120. */
  121. public function getOption(Name:String) : Dynamic;
  122. /**
  123. * Register FirePHP as your error handler
  124. * Will throw exceptions for each php error.
  125. * @return mixed Returns a string containing the previously defined error handler (if any)
  126. */
  127. public function registerErrorHandler(throwErrorExceptions:Bool=false) : Dynamic;
  128. /**
  129. * FirePHP's error handler
  130. * Throws exception for each php error that will occur.
  131. */
  132. public function errorHandler(errno:Int, errstr:String, errfile:String, errline:Int, errcontext:NativeArray) : Void;
  133. /**
  134. * Register FirePHP as your exception handler
  135. * @return mixed Returns the name of the previously defined exception handler,
  136. * or NULL on error.
  137. * If no previous handler was defined, NULL is also returned.
  138. */
  139. public function registerExceptionHandler() : Dynamic;
  140. /**
  141. * FirePHP's exception handler
  142. * Logs all exceptions to your firebug console and then stops the script.
  143. * @throws Exception
  144. */
  145. public function exceptionHandler(Exception:Exception) : Void;
  146. /**
  147. * Register FirePHP driver as your assert callback
  148. * @return mixed Returns the original setting or FALSE on errors
  149. */
  150. public function registerAssertionHandler(convertAssertionErrorsToExceptions:Bool=true, throwAssertionExceptions:Bool=false) : Dynamic;
  151. /**
  152. * FirePHP's assertion handler
  153. * Logs all assertions to your firebug console and then stops the script.
  154. * @param file File source of assertion
  155. * @param line Line source of assertion
  156. * @param code Assertion code
  157. */
  158. public function assertionHandler(file:String, line:Int, code:Dynamic) : Void;
  159. /**
  160. * Start a group for following messages.
  161. * Options:
  162. * Collapsed: [true|false]
  163. * Color: [#RRGGBB|ColorName]
  164. * @param Options OPTIONAL Instructions on how to log the group
  165. * @throws Exception
  166. */
  167. public function group(Name:String, Options:NativeArray=null) : Bool;
  168. /**
  169. * Ends a group you have started before
  170. * @throws Exception
  171. */
  172. public function groupEnd() : Bool;
  173. /**
  174. * Log object with label to firebug console
  175. * @see FirePHP::LOG
  176. * @throws Exception
  177. */
  178. public function log(Object:Dynamic, Label:String=null, Options:NativeArray=untyped __php__("array()")) : Bool;
  179. /**
  180. * Log object with label to firebug console
  181. * @see FirePHP::INFO
  182. * @throws Exception
  183. */
  184. public function info(Object:Dynamic, Label:String=null, Options:NativeArray=untyped __php__("array()")) : Bool;
  185. /**
  186. * Log object with label to firebug console
  187. * @see FirePHP::WARN
  188. * @throws Exception
  189. */
  190. public function warn(Object:Dynamic, Label:String=null, Options:NativeArray=untyped __php__("array()")) : Bool;
  191. /**
  192. * Log object with label to firebug console
  193. * @see FirePHP::ERROR
  194. * @throws Exception
  195. */
  196. public function error(Object:Dynamic, Label:String=null, Options:NativeArray=untyped __php__("array()")) : Bool;
  197. /**
  198. * Dumps key and variable to firebug server panel
  199. * @see FirePHP::DUMP
  200. * @throws Exception
  201. */
  202. public function dump(Key:String, Variable:Dynamic, Options:NativeArray=untyped __php__("array()")) : Bool;
  203. /**
  204. * Log a trace in the firebug console
  205. * @see FirePHP::TRACE
  206. * @throws Exception
  207. */
  208. public function trace(Label:String) : Bool;
  209. /**
  210. * Log a table in the firebug console
  211. * @see FirePHP::TABLE
  212. * @throws Exception
  213. */
  214. public function table(Label:String, Table:String, Options:NativeArray=untyped __php__("array()")) : Bool;
  215. /**
  216. * Insight API wrapper
  217. * @see Insight_Helper::to()
  218. */
  219. public static function to() : Dynamic;
  220. /**
  221. * Insight API wrapper
  222. * @see Insight_Helper::plugin()
  223. */
  224. public static function plugin() : Dynamic;
  225. /**
  226. * Check if FirePHP is installed on client
  227. */
  228. public function detectClientExtension() : Bool;
  229. /**
  230. * Log varible to Firebug
  231. * @see http://www.firephp.org/Wiki/Reference/Fb
  232. * @param Object The variable to be logged
  233. * @return true Return TRUE if message was added to headers, FALSE otherwise
  234. * @throws Exception
  235. */
  236. public function fb(Object:Dynamic) : Bool;
  237. /**
  238. * Get all request headers
  239. */
  240. public static function getAllRequestHeaders() : NativeArray;
  241. /**
  242. * Encode an object into a JSON string
  243. * Uses PHP's jeson_encode() if available
  244. * @param Object The object to be encoded
  245. * @return string The JSON string
  246. */
  247. public function jsonEncode(Object:Dynamic, skipObjectEncode:Bool=false) : String;
  248. }