|
21 | 21 | $loader = include 'vendor/autoload.php'; |
22 | 22 | } |
23 | 23 |
|
24 | | -if (!class_exists('Zend\Loader\AutoloaderFactory')) { |
25 | | - $zf2Path = false; |
26 | | - |
27 | | - if (is_dir('vendor/ZF2/library')) { |
28 | | - $zf2Path = 'vendor/ZF2/library'; |
29 | | - } elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule |
30 | | - $zf2Path = getenv('ZF2_PATH'); |
31 | | - } elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value |
32 | | - $zf2Path = get_cfg_var('zf2_path'); |
33 | | - } |
34 | | - |
35 | | - if ($zf2Path) { |
36 | | - if (isset($loader)) { |
37 | | - $loader->add('Zend', $zf2Path); |
38 | | - $loader->add('ZendXml', $zf2Path); |
39 | | - } else { |
40 | | - include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; |
41 | | - Zend\Loader\AutoloaderFactory::factory(array( |
42 | | - 'Zend\Loader\StandardAutoloader' => array( |
43 | | - 'autoregister_zf' => true |
44 | | - ) |
45 | | - )); |
46 | | - } |
| 24 | +if (class_exists('Zend\Loader\AutoloaderFactory')) { |
| 25 | + return; |
| 26 | +} |
| 27 | + |
| 28 | +$zf2Path = false; |
| 29 | + |
| 30 | +if (is_dir('vendor/ZF2/library')) { |
| 31 | + $zf2Path = 'vendor/ZF2/library'; |
| 32 | +} elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule |
| 33 | + $zf2Path = getenv('ZF2_PATH'); |
| 34 | +} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value |
| 35 | + $zf2Path = get_cfg_var('zf2_path'); |
| 36 | +} |
| 37 | + |
| 38 | +if ($zf2Path) { |
| 39 | + if (isset($loader)) { |
| 40 | + $loader->add('Zend', $zf2Path); |
| 41 | + $loader->add('ZendXml', $zf2Path); |
| 42 | + } else { |
| 43 | + include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; |
| 44 | + Zend\Loader\AutoloaderFactory::factory(array( |
| 45 | + 'Zend\Loader\StandardAutoloader' => array( |
| 46 | + 'autoregister_zf' => true |
| 47 | + ) |
| 48 | + )); |
47 | 49 | } |
48 | 50 | } |
49 | 51 |
|
| 52 | + |
50 | 53 | if (!class_exists('Zend\Loader\AutoloaderFactory')) { |
51 | 54 | throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); |
52 | 55 | } |
0 commit comments