diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-06-26 10:23:15 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-06-26 10:23:15 +0200 |
commit | 7c5be1ee6a3c1f699bab9a8a11680c9d13af3817 (patch) | |
tree | b1f635441a3839d9e3b28a2bb4bd15a329c824df /php-bartlett-PHP-Reflect-autoload.php | |
parent | 4ad6a01536450b28c067b9a455bcbcae674fb515 (diff) |
rewite autoloader
Diffstat (limited to 'php-bartlett-PHP-Reflect-autoload.php')
-rw-r--r-- | php-bartlett-PHP-Reflect-autoload.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php new file mode 100644 index 0000000..9fe6a64 --- /dev/null +++ b/php-bartlett-PHP-Reflect-autoload.php @@ -0,0 +1,46 @@ +<?php +/** + * Autoloader for bartlett/php-reflect and its dependencies + */ + +$vendorDir = '/usr/share/php'; + +// Use Symfony autoloader +if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { + if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { + require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php'; + } + + $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); + $fedoraClassLoader->register(); +} +$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')) { + $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); +} |