本文整理匯總了PHP中Puli\Manager\Assert\Assert::nullOrDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assert::nullOrDirectory方法的具體用法?PHP Assert::nullOrDirectory怎麽用?PHP Assert::nullOrDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Puli\Manager\Assert\Assert
的用法示例。
在下文中一共展示了Assert::nullOrDirectory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Creates the context.
*
* @param string|null $homeDir The path to the home directory
* or `null` if none exists.
* @param Config $config The configuration.
* @param ConfigFile $configFile The configuration file or
* `null` if none exists.
* @param EventDispatcherInterface $dispatcher The event dispatcher.
*/
public function __construct($homeDir, Config $config, ConfigFile $configFile = null, EventDispatcherInterface $dispatcher = null)
{
Assert::nullOrDirectory($homeDir, 'The home directory %s is not a directory.');
$this->homeDir = $homeDir ? Path::canonicalize($homeDir) : null;
$this->config = $config;
$this->dispatcher = $dispatcher ?: new EventDispatcher();
$this->configFile = $configFile;
}
示例2: setRootDirectory
/**
* Sets the root directory of the managed Puli project.
*
* @param string|null $rootDir The root directory of the managed Puli
* project or `null` to start Puli outside of a
* specific project.
*/
public function setRootDirectory($rootDir)
{
if ($this->started) {
throw new LogicException('Puli is already started');
}
Assert::nullOrDirectory($rootDir);
$this->rootDir = $rootDir ? Path::canonicalize($rootDir) : null;
}