Dev.class.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * A development class for troubleshooting
  4. *
  5. * @author Ironpilot
  6. * @copyright Copywrite (c) 2011, STAPLE CODE
  7. *
  8. * This file is part of the STAPLE Framework.
  9. *
  10. * The STAPLE Framework is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Lesser General Public License as published by the
  12. * Free Software Foundation, either version 3 of the License, or (at your option)
  13. * any later version.
  14. *
  15. * The STAPLE Framework is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  17. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
  18. * more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public License
  21. * along with the STAPLE Framework. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. class Staple_Dev
  25. {
  26. protected static $timer;
  27. /**
  28. * This function takes multiple arguments and dumps them to the source code.
  29. */
  30. public static function Dump()
  31. {
  32. if(class_exists('Staple_Config'))
  33. {
  34. if(Staple_Config::getValue('errors', 'devmode') == 1)
  35. {
  36. $args = func_get_args();
  37. echo "<pre>";
  38. foreach($args as $dumper)
  39. {
  40. var_dump($dumper);
  41. echo "\n";
  42. }
  43. echo "</pre>";
  44. }
  45. }
  46. else
  47. {
  48. $args = func_get_args();
  49. echo "<pre>";
  50. foreach($args as $dumper)
  51. {
  52. var_dump($dumper);
  53. echo "\n";
  54. }
  55. echo "</pre>";
  56. }
  57. }
  58. /**
  59. * Starts a script timer.
  60. */
  61. public static function StartTimer()
  62. {
  63. self::$timer = microtime(true);
  64. }
  65. /**
  66. * Stops a previously started timer.
  67. */
  68. public static function StopTimer()
  69. {
  70. return microtime(true) - self::$timer;
  71. }
  72. public static function GetRouteInfo()
  73. {
  74. $blah = Staple_Main::getRoute();
  75. }
  76. /*public static function ResetController(Staple_Controller $controllerRef)
  77. {
  78. //$controllerRef::__destruct();
  79. unset($controllerRef);
  80. }
  81. public static function ResetAuth()
  82. {
  83. $auth = Staple_Auth::get();
  84. $auth->clearAuth();
  85. $auth::__destruct();
  86. unset($auth);
  87. }*/
  88. }
  89. ?>