PageRenderTime 33ms CodeModel.GetById 31ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/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/*
 4 * This file is part of the FOSFacebookBundle package.
 5 *
 6 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 7 *
 8 * For the full copyright and license information, please view the LICENSE
 9 * file that was distributed with this source code.
10 */
11
12$vendorDir = __DIR__.'/../vendor';
13require_once $vendorDir.'/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
14
15use Symfony\Component\ClassLoader\UniversalClassLoader;
16
17$loader = new UniversalClassLoader();
18$loader->registerNamespaces(array(
19    'Symfony'                => array($vendorDir.'/symfony/src'),
20));
21$loader->registerPrefixes(array(
22    'Twig_'            => $vendorDir.'/twig/lib',
23));
24$loader->register();
25
26spl_autoload_register(function($class) {
27    if (0 === strpos($class, 'FOS\\FacebookBundle\\')) {
28        $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php';
29        if (!stream_resolve_include_path($path)) {
30            return false;
31        }
32        require_once $path;
33        return true;
34    }
35});