autoload.php 520 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /*
  3. * This file is part of the Stash package.
  4. *
  5. * (c) Robert Hafner <tedivm@tedivm.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. spl_autoload_register(function ($class) {
  11. $base = '/src/';
  12. if (strpos($class, 'Stash\Test') === 0) {
  13. $base = '/tests/';
  14. }
  15. $file = __DIR__.$base.strtr($class, '\\', '/').'.php';
  16. if (file_exists($file)) {
  17. require $file;
  18. return true;
  19. }
  20. });