本文整理汇总了PHP中Puli\Manager\Assert\Assert::absoluteSystemPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::absoluteSystemPath方法的具体用法?PHP Assert::absoluteSystemPath怎么用?PHP Assert::absoluteSystemPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Puli\Manager\Assert\Assert
的用法示例。
在下文中一共展示了Assert::absoluteSystemPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates a new package.
*
* @param PackageFile|null $packageFile The package file or `null` if the
* package file could not be loaded.
* @param string $installPath The absolute install path.
* @param InstallInfo|null $installInfo The install info of this package.
* @param Exception[] $loadErrors The errors that happened during
* loading of the package, if any.
*/
public function __construct(PackageFile $packageFile = null, $installPath, InstallInfo $installInfo = null, array $loadErrors = array())
{
Assert::absoluteSystemPath($installPath);
Assert::true($packageFile || $loadErrors, 'The load errors must be passed if the package file is null.');
Assert::allIsInstanceOf($loadErrors, 'Exception');
// If a package name was set during installation, that name wins over
// the predefined name in the puli.json file (if any)
$this->name = $installInfo && null !== $installInfo->getPackageName() ? $installInfo->getPackageName() : ($packageFile ? $packageFile->getPackageName() : null);
if (null === $this->name) {
$this->name = $this->getDefaultName();
}
// The path is stored both here and in the install info. While the
// install info contains the path as it is stored in the install file
// (i.e. relative or absolute), the install path of the package is
// always an absolute path.
$this->installPath = $installPath;
$this->installInfo = $installInfo;
$this->packageFile = $packageFile;
$this->loadErrors = $loadErrors;
if (!file_exists($installPath)) {
$this->state = PackageState::NOT_FOUND;
} elseif (count($loadErrors) > 0) {
$this->state = PackageState::NOT_LOADABLE;
} else {
$this->state = PackageState::ENABLED;
}
}