bootstrap.php 679B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /*
  3. * This file is part of the Metadata 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, 'Metadata\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, 'Metadata\\')) {
  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. }
  23. });