diff options
Diffstat (limited to 'php-bartlett-PHP-Reflect-autoload.php')
-rw-r--r-- | php-bartlett-PHP-Reflect-autoload.php | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php index fc451b5..5f23681 100644 --- a/php-bartlett-PHP-Reflect-autoload.php +++ b/php-bartlett-PHP-Reflect-autoload.php @@ -3,42 +3,25 @@ * 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'; - } +require_once '/usr/share/php/Fedora/Autoloader/autoload.php'; - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} -$fedoraClassLoader->addPrefixes(array( - 'Symfony\\Component' => $vendorDir, - 'Bartlett' => dirname(dirname(__DIR__)), +\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\', dirname(__DIR__)); +\Fedora\Autoloader\Dependencies::required(array( + '/usr/share/php/Symfony/Component/autoload.php', + '/usr/share/php/PhpParser/autoload.php', + '/usr/share/php/Seld/JsonLint/autoload.php', + '/usr/share/php/JsonSchema/autoload.php', + '/usr/share/php/SebastianBergmann/Version/autoload.php', + '/usr/share/php/Doctrine/Common/Collections/autoload.php', + '/usr/share/php/Doctrine/Common/Cache/autoload.php', + '/usr/share/php/phpDocumentor/Reflection/DocBlock/autoload.php', +)); +\Fedora\Autoloader\Dependencies::optional(array( + '/usr/share/php/Bartlett/CompatInfo/autoload.php', // Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser' + '/usr/share/php/Bartlett/UmlWriter/autoload.php', + '/usr/share/php/Psr/Log/autoload.php', + '/usr/share/php/Monolog/autoload.php', )); -// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser' -if (is_dir("$vendorDir/Bartlett/CompatInfo")) { - $fedoraClassLoader->addPrefix('Bartlett\\CompatInfo', $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; - } -} +$vendorDir = '/usr/share/php'; |