You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuOutputFormatter.php 588B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Luticate\Utils;
  3. class LuOutputFormatter
  4. {
  5. public static $APP_VERSION = 1.0;
  6. public static function getResponse()
  7. {
  8. return array(
  9. "Version" => self::$APP_VERSION,
  10. "Data" => null,
  11. "Message" => null
  12. );
  13. }
  14. public static function formatSuccess($data)
  15. {
  16. $r = self::getResponse();
  17. $r["Data"] = $data;
  18. return $r;
  19. }
  20. public static function formatError($code, $message)
  21. {
  22. $r = self::getResponse();
  23. $r["Message"] = $message;
  24. return $r;
  25. }
  26. }