PageRenderTime 55ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/php/Libs/Core/Assert.php

https://bitbucket.org/pies/oem
PHP | 24 lines | 18 code | 6 blank | 0 comment | 1 complexity | 5ab6570a11567df57fc04c3e5b1180a3 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. namespace Core;
  3. class Assert {
  4. public static function Handler($file, $line, $code) {
  5. $place = pretty_path($file, $line);
  6. output($code, "Assertion failed at {$place}");
  7. }
  8. public static function Init($active=true) {
  9. assert_options(ASSERT_ACTIVE, $active);
  10. if (!$active) return false;
  11. assert_options(ASSERT_WARNING, 0);
  12. assert_options(ASSERT_QUIET_EVAL, 1);
  13. assert_options(ASSERT_CALLBACK, array(__CLASS__, 'Handler'));
  14. assert("function_exists('output')");
  15. assert("function_exists('pretty_path')");
  16. }
  17. }
  18. ?>