diff options
author | Remi Collet <fedora@famillecollet.com> | 2016-07-06 07:27:00 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2016-07-06 07:27:00 +0200 |
commit | 62656a0f91983ccf6c49f9310f39ce2982742043 (patch) | |
tree | f1eb0f26e4bdbd9813bbbefcef2661a22c3da2f7 /php-bartlett-PHP-Reflect-autoload.php | |
parent | 3a7eaa5e04f09eb9af0a5742d2e83d74d27cc7ec (diff) |
php-bartlett-PHP-Reflect: 4.0.1
Diffstat (limited to 'php-bartlett-PHP-Reflect-autoload.php')
-rw-r--r-- | php-bartlett-PHP-Reflect-autoload.php | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php index 9fe6a64..fc451b5 100644 --- a/php-bartlett-PHP-Reflect-autoload.php +++ b/php-bartlett-PHP-Reflect-autoload.php @@ -16,31 +16,29 @@ if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Compo } $fedoraClassLoader->addPrefixes(array( 'Symfony\\Component' => $vendorDir, - 'JsonSchema' => $vendorDir, - 'Seld\\JsonLint' => $vendorDir, 'Bartlett' => dirname(dirname(__DIR__)), )); -// Mandatory dependencies -require_once $vendorDir . '/PhpParser/Autoloader.php'; -PhpParser\Autoloader::register(); -require_once $vendorDir . '/SebastianBergmann/Version/autoload.php'; -require_once $vendorDir . '/Doctrine/Common/Collections/autoload.php'; -require_once $vendorDir . '/Doctrine/Common/Cache/autoload.php'; -require_once $vendorDir . '/phpDocumentor/Reflection/DocBlock/autoload.php'; - // Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser' -if (is_dir($vendorDir . '/Bartlett/CompatInfo')) { +if (is_dir("$vendorDir/Bartlett/CompatInfo")) { $fedoraClassLoader->addPrefix('Bartlett\\CompatInfo', $vendorDir); } -// Optional dependencies -if (file_exists($vendorDir . '/Bartlett/UmlWriter/autoload.php')) { - require_once $vendorDir . '/Bartlett/UmlWriter/autoload.php'; -} -if (is_dir($vendorDir . '/Psr/Log')) { - $fedoraClassLoader->addPrefix('Psr\\Log', $vendorDir); -} -if (is_dir($vendorDir . '/Monolog')) { - $fedoraClassLoader->addPrefix('Monolog', $vendorDir); +// Dependencies (autoloader => required) +foreach(array( + "$vendorDir/PhpParser/autoload.php" => true, + "$vendorDir/Seld/JsonLint/autoload.php" => true, + "$vendorDir/JsonSchema/autoload.php" => true, + "$vendorDir/SebastianBergmann/Version/autoload.php" => true, + "$vendorDir/Doctrine/Common/Collections/autoload.php" => true, + "$vendorDir/Doctrine/Common/Cache/autoload.php" => true, + "$vendorDir/phpDocumentor/Reflection/DocBlock/autoload.php" => true, + "$vendorDir/Bartlett/UmlWriter/autoload.php" => false, + "$vendorDir/Psr/Log/autoload.php" => false, + "$vendorDir/Monolog/autoload.php" => false, +) as $dependencyAutoloader => $required) { + if ($required || file_exists($dependencyAutoloader)) { + require_once $dependencyAutoloader; + } } + |