create() public static method

public static create ( mixed $seedArrayOrExtensionKeyOrManifestPath ) : FluidTYPO3\Flux\Package\FluxPackageInterface
$seedArrayOrExtensionKeyOrManifestPath mixed
return FluidTYPO3\Flux\Package\FluxPackageInterface
Beispiel #1
0
 /**
  * Returns the FluxPackage instance associated with
  * and possibly existing in $qualifiedExtensionName.
  *
  * @param string $qualifiedExtensionName
  * @return FluxPackageInterface
  */
 public static function getPackage($qualifiedExtensionName)
 {
     if (empty($qualifiedExtensionName)) {
         throw new PackageNotFoundException('Package name cannot be empty');
     }
     $extensionKey = ExtensionNamingUtility::getExtensionKey($qualifiedExtensionName);
     if (!ExtensionManagementUtility::isLoaded($extensionKey)) {
         throw new PackageNotFoundException(sprintf('Package name %s (extension key %s) is not loaded', $qualifiedExtensionName, $extensionKey));
     }
     if (!array_key_exists($extensionKey, static::$packages)) {
         $manifestPath = ExtensionManagementUtility::extPath($extensionKey, 'flux.json');
         static::$packages[$extensionKey] = FluxPackage::create($manifestPath)->upcast();
     }
     return static::$packages[$extensionKey];
 }