bootstrap.php 936B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the CG library.
  4. *
  5. * (C) 2011 Johannes M. Schmitt <schmittjoh@gmail.com>
  6. *
  7. */
  8. spl_autoload_register(function($class)
  9. {
  10. if (0 === strpos($class, 'CG\Tests\\')) {
  11. $path = __DIR__.'/../tests/'.strtr($class, '\\', '/').'.php';
  12. if (file_exists($path) && is_readable($path)) {
  13. require_once $path;
  14. return true;
  15. }
  16. } else if (0 === strpos($class, 'CG\\')) {
  17. $path = __DIR__.'/../src/'.($class = strtr($class, '\\', '/')).'.php';
  18. if (file_exists($path) && is_readable($path)) {
  19. require_once $path;
  20. return true;
  21. }
  22. } else if (0 === strpos($class, 'Zend\\')) {
  23. $path = __DIR__.'/../../zend-framework2/library/'.($class = strtr($class, '\\', '/')).'.php';
  24. if (file_exists($path) && is_readable($path)) {
  25. require_once $path;
  26. return true;
  27. }
  28. }
  29. });