Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.

Commit 48807d9

Browse files
committed
if (class_exists("yaddayadda")) { return }
1 parent 889880c commit 48807d9

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

init_autoloader.php

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,35 @@
2121
$loader = include 'vendor/autoload.php';
2222
}
2323

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+
));
4749
}
4850
}
4951

52+
5053
if (!class_exists('Zend\Loader\AutoloaderFactory')) {
5154
throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
5255
}

0 commit comments

Comments
 (0)