本文整理汇总了PHP中PackageManager::isPackageKeyValid方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageManager::isPackageKeyValid方法的具体用法?PHP PackageManager::isPackageKeyValid怎么用?PHP PackageManager::isPackageKeyValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageManager
的用法示例。
在下文中一共展示了PackageManager::isPackageKeyValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param PackageManager $packageManager the package manager which knows this package
* @param string $packageKey Key of this package
* @param string $packagePath Absolute path to the location of the package's composer manifest
* @throws Exception\InvalidPackageKeyException if an invalid package key was passed
* @throws Exception\InvalidPackagePathException if an invalid package path was passed
* @throws Exception\InvalidPackageManifestException if no composer manifest file could be found
*/
public function __construct(PackageManager $packageManager, $packageKey, $packagePath)
{
if (!$packageManager->isPackageKeyValid($packageKey)) {
throw new Exception\InvalidPackageKeyException('"' . $packageKey . '" is not a valid package key.', 1217959511);
}
if (!(@is_dir($packagePath) || is_link($packagePath) && is_dir($packagePath))) {
throw new Exception\InvalidPackagePathException(sprintf('Tried to instantiate a package object for package "%s" with a non-existing package path "%s". Either the package does not exist anymore, or the code creating this object contains an error.', $packageKey, $packagePath), 1166631890);
}
if (substr($packagePath, -1, 1) !== '/') {
throw new Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633722);
}
$this->packageManager = $packageManager;
$this->packageKey = $packageKey;
$this->packagePath = $packagePath;
try {
$this->composerManifest = $this->packageManager->getComposerManifest($this->packagePath);
} catch (Exception\MissingPackageManifestException $exception) {
if (!$this->loadExtensionEmconf()) {
throw new Exception\InvalidPackageManifestException('No valid ext_emconf.php file found for package "' . $packageKey . '".', 1360403545);
}
}
$this->loadFlagsFromComposerManifest();
}