/Tests/autoload.php.dist

http://github.com/FriendsOfSymfony/FOSFacebookBundle · Unknown · 35 lines · 30 code · 5 blank · 0 comment · 0 complexity · 7b32266433874ea5f617c37d7bdeb966 MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of the FOSFacebookBundle package.
  4. *
  5. * (c) FriendsOfSymfony <http://friendsofsymfony.github.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. $vendorDir = __DIR__.'/../vendor';
  11. require_once $vendorDir.'/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
  12. use Symfony\Component\ClassLoader\UniversalClassLoader;
  13. $loader = new UniversalClassLoader();
  14. $loader->registerNamespaces(array(
  15. 'Symfony' => array($vendorDir.'/symfony/src'),
  16. ));
  17. $loader->registerPrefixes(array(
  18. 'Twig_' => $vendorDir.'/twig/lib',
  19. ));
  20. $loader->register();
  21. spl_autoload_register(function($class) {
  22. if (0 === strpos($class, 'FOS\\FacebookBundle\\')) {
  23. $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php';
  24. if (!stream_resolve_include_path($path)) {
  25. return false;
  26. }
  27. require_once $path;
  28. return true;
  29. }
  30. });