Created
May 8, 2014 13:53
-
-
Save mneuhaus/929667396056afc16e8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sets the available packages | |
* | |
* @param array $allPackages An array of \TYPO3\Flow\Package\Package objects | |
* @param array $activePackages An array of \TYPO3\Flow\Package\Package objects | |
* @return void | |
*/ | |
public function setPackages(array $allPackages, array $activePackages) { | |
foreach ($allPackages as $packageKey => $package) { | |
if (isset($activePackages[$packageKey])) { | |
if ($package->getAutoloadType() === Package::AUTOLOADER_TYPE_PSR0) { | |
$this->createNamespaceMapEntry($package->getNamespace(), $package->getClassesPath(), self::MAPPING_TYPE_PSR0); | |
} else if ($package->getAutoloadType() === Package::AUTOLOADER_TYPE_PSR4) { | |
$this->createNamespaceMapEntry($package->getNamespace(), $package->getClassesPath(), self::MAPPING_TYPE_PSR4); | |
} | |
if ($this->considerTestsNamespace) { | |
$this->createNamespaceMapEntry($package->getNamespace(), $package->getPackagePath(), self::MAPPING_TYPE_PSR4); | |
} | |
} else { | |
// Remove entries coming from composer for inactive packages. | |
$this->removeNamespaceMapEntry($package->getNamespace(), $package->getClassesPath()); | |
if ($this->considerTestsNamespace) { | |
$this->removeNamespaceMapEntry($package->getNamespace(), $package->getPackagePath(), self::MAPPING_TYPE_PSR4); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment