|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Zend Framework (http://framework.zend.com/) |
| 4 | + * |
| 5 | + * @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository |
| 6 | + * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) |
| 7 | + * @license http://framework.zend.com/license/new-bsd New BSD License |
| 8 | + */ |
| 9 | + |
| 10 | +/** |
| 11 | + * This autoloading setup is really more complicated than it needs to be for most |
| 12 | + * applications. The added complexity is simply to reduce the time it takes for |
| 13 | + * new developers to be productive with a fresh skeleton. It allows autoloading |
| 14 | + * to be correctly configured, regardless of the installation method and keeps |
| 15 | + * the use of composer completely optional. This setup should work fine for |
| 16 | + * most users, however, feel free to configure autoloading however you'd like. |
| 17 | + */ |
| 18 | + /* |
| 19 | +$autoLoader = new \Zend\Loader\StandardAutoloader(array( |
| 20 | + 'namespaces' => array( |
| 21 | + 'ZendDevOps\DepH' => __DIR__ . '/ZendDevOps/DepH', |
| 22 | + ), |
| 23 | +
|
| 24 | + 'fallback_autoloader' => true, |
| 25 | +)); |
| 26 | +*/ |
| 27 | + |
| 28 | + |
| 29 | +// Composer autoloading |
| 30 | +if (file_exists('vendor/autoload.php')) { |
| 31 | + $loader = include 'vendor/autoload.php'; |
| 32 | +} |
| 33 | + |
| 34 | +if (class_exists('Zend\Loader\AutoloaderFactory')) { |
| 35 | + $config = array( |
| 36 | + 'Zend\Loader\StandardAutoloader' => array( |
| 37 | + 'namespaces' => array( |
| 38 | + 'ZendDevOps\DepH' => __DIR__ . '/ZendDevOps/DepH' |
| 39 | + ), |
| 40 | + ), |
| 41 | + ); |
| 42 | + Zend\Loader\AutoloaderFactory::factory($config); |
| 43 | + return; |
| 44 | +} |
| 45 | + |
| 46 | +$zf2Path = false; |
| 47 | + |
| 48 | +if (is_dir('vendor/ZF2/library')) { |
| 49 | + $zf2Path = 'vendor/ZF2/library'; |
| 50 | +} elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule |
| 51 | + $zf2Path = getenv('ZF2_PATH'); |
| 52 | +} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value |
| 53 | + $zf2Path = get_cfg_var('zf2_path'); |
| 54 | +} |
| 55 | + |
| 56 | +if ($zf2Path) { |
| 57 | + if (isset($loader)) { |
| 58 | + $loader->add('Zend', $zf2Path); |
| 59 | + $loader->add('ZendXml', $zf2Path); |
| 60 | + } else { |
| 61 | + include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; |
| 62 | + Zend\Loader\AutoloaderFactory::factory(array( |
| 63 | + 'Zend\Loader\StandardAutoloader' => array( |
| 64 | + 'autoregister_zf' => true |
| 65 | + ) |
| 66 | + )); |
| 67 | + } |
| 68 | +} |
| 69 | + |
| 70 | +if (!class_exists('Zend\Loader\AutoloaderFactory')) { |
| 71 | + throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); |
| 72 | +} |
0 commit comments