/** * Register a native TYPO3 package * * @param PackageInterface $package The Package to be registered * @param bool $sortAndSave allows for not saving packagestates when used in loops etc. * @return PackageInterface * @throws Exception\InvalidPackageStateException * @throws Exception\PackageStatesFileNotWritableException */ public function registerPackage(PackageInterface $package, $sortAndSave = TRUE) { $packageKey = $package->getPackageKey(); if ($this->isPackageAvailable($packageKey)) { throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is already registered.', 1338996122); } $this->packages[$packageKey] = $package; $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $package->getPackagePath()); if ($sortAndSave === TRUE) { $this->sortAndSavePackageStates(); } if ($package instanceof PackageInterface) { foreach ($package->getPackageReplacementKeys() as $packageToReplace => $versionConstraint) { $this->packageAliasMap[strtolower($packageToReplace)] = $package->getPackageKey(); } } return $package; }
/** * @param PackageInterface $package * @return void */ protected function buildPackageClassPathsForLegacyExtension(PackageInterface $package) { $this->packageClassesPaths[$package->getPackageKey()] = $package->getClassesPath(); foreach ($package->getPackageReplacementKeys() as $packageToReplace => $_) { $this->packageClassesPaths[$packageToReplace] = $package->getClassesPath(); } }
/** * Register a native TYPO3 package * * @param PackageInterface $package The Package to be registered * @return PackageInterface * @throws Exception\InvalidPackageStateException * @throws Exception\PackageStatesFileNotWritableException */ public function registerPackage(PackageInterface $package) { $packageKey = $package->getPackageKey(); if ($this->isPackageAvailable($packageKey)) { throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is already registered.', 1338996122); } $this->packages[$packageKey] = $package; if ($package instanceof PackageInterface) { foreach ($package->getPackageReplacementKeys() as $packageToReplace => $versionConstraint) { $this->packageAliasMap[strtolower($packageToReplace)] = $package->getPackageKey(); } } return $package; }