本文整理汇总了PHP中Webmozart\Assert\Assert::boolean方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::boolean方法的具体用法?PHP Assert::boolean怎么用?PHP Assert::boolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Assert\Assert
的用法示例。
在下文中一共展示了Assert::boolean方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $variableName
* @param Type $type
* @param bool $isVariadic
* @param Description $description
*/
public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null)
{
Assert::string($variableName);
Assert::boolean($isVariadic);
$this->variableName = $variableName;
$this->type = $type;
$this->isVariadic = $isVariadic;
$this->description = $description;
}
示例2: isValid
/**
* Fetch the result of the modulus check on the account.
*
* @param bool $assume Result to use if the account could not be validated.
*
* @return bool True if details are usable
*/
public function isValid($assume = true)
{
try {
Assert::boolean($assume, 'assume should be a boolean, got: `%s`');
} catch (\InvalidArgumentException $e) {
throw E::wrap($e);
}
return $this->specKnown ? $this->specResult : $assume;
}
示例3: __construct
/**
* Create a Serializer instance.
*
* @param int $indent The number of times the indent string is repeated.
* @param string $indentString The string to indent the comment with.
* @param bool $indentFirstLine Whether to indent the first line.
* @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
*/
public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null)
{
Assert::integer($indent);
Assert::string($indentString);
Assert::boolean($indentFirstLine);
Assert::nullOrInteger($lineLength);
$this->indent = $indent;
$this->indentString = $indentString;
$this->isFirstLineIndented = $indentFirstLine;
$this->lineLength = $lineLength;
}
示例4: __construct
public function __construct($methodName, array $arguments = [], Type $returnType = null, $static = false, Description $description = null)
{
Assert::stringNotEmpty($methodName);
Assert::boolean($static);
if ($returnType === null) {
$returnType = new Void();
}
$this->methodName = $methodName;
$this->arguments = $this->filterArguments($arguments);
$this->returnType = $returnType;
$this->isStatic = $static;
$this->description = $description;
}
示例5: __construct
/**
* @param string $summary
* @param DocBlock\Description $description
* @param DocBlock\Tag[] $tags
* @param Context $context The context in which the DocBlock occurs.
* @param Location $location The location within the file that this DocBlock occurs in.
* @param bool $isTemplateStart
* @param bool $isTemplateEnd
*/
public function __construct($summary = '', DocBlock\Description $description = null, array $tags = [], Context $context = null, Location $location = null, $isTemplateStart = false, $isTemplateEnd = false)
{
Assert::string($summary);
Assert::boolean($isTemplateStart);
Assert::boolean($isTemplateEnd);
$this->summary = $summary;
$this->description = $description ?: new DocBlock\Description('');
foreach ($tags as $tag) {
$this->addTag($tag);
}
$this->context = $context;
$this->location = $location;
$this->isTemplateEnd = $isTemplateEnd;
$this->isTemplateStart = $isTemplateStart;
}
示例6: getOptions
/**
* Returns all options added to the builder.
*
* @param bool $includeBase Whether to include options of the base format
* in the result.
*
* @return Option[] The options.
*/
public function getOptions($includeBase = true)
{
Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
$options = $this->options;
if ($includeBase && $this->baseFormat) {
// append base options
$options = array_replace($options, $this->baseFormat->getOptions());
}
return $options;
}
示例7: setDebug
/**
* Sets whether the application is in debug mode.
*
* In debug mode, the verbosity is always {@link IO::DEBUG}.
*
* @param bool $debug Set to `true` to activate the debug mode.
*
* @return static The current instance.
*
* @see isDebug()
*/
public function setDebug($debug)
{
Assert::boolean($debug);
$this->debug = $debug;
return $this;
}
示例8: setTracked
/**
* {@inheritdoc}
*/
public function setTracked($tracked)
{
Assert::boolean($tracked);
$this->tracked = $tracked;
}
示例9: hasOptions
/**
* Returns whether the format contains options.
*
* @param bool $includeBase Whether to include options in the base format
* in the search.
*
* @return bool Returns `true` if the format contains options and `false`
* otherwise.
*/
public function hasOptions($includeBase = true)
{
Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
if (count($this->options) > 0) {
return true;
}
if ($includeBase && $this->baseFormat) {
return $this->baseFormat->hasOptions();
}
return false;
}
示例10: __construct
/**
* Creates a new repository.
*
* @param string $baseDir The base directory of the repository on the file
* system.
* @param bool $symlink Whether to use symbolic links for added files. If
* symbolic links are not supported on the current
* system, the repository will create hard copies
* instead.
* @param bool $relative Whether to create relative symbolic links. If
* relative links are not supported on the current
* system, the repository will create absolute links
* instead.
* @param ChangeStream|null $changeStream If provided, the repository will log
* resources changes in this change stream.
*/
public function __construct($baseDir = '/', $symlink = true, $relative = true, ChangeStream $changeStream = null)
{
parent::__construct($changeStream);
Assert::directory($baseDir);
Assert::boolean($symlink);
$this->baseDir = rtrim(Path::canonicalize($baseDir), '/');
$this->baseDirLength = strlen($baseDir);
$this->symlink = $symlink && self::isSymlinkSupported();
$this->relative = $this->symlink && $relative;
$this->filesystem = new Filesystem();
}
示例11: __construct
/**
* Creates a new repository.
*
* @param string $baseDir The base directory of the repository on the file
* system.
* @param bool $symlink Whether to use symbolic links for added files. If
* symbolic links are not supported on the current
* system, the repository will create hard copies
* instead.
* @param bool $relative Whether to create relative symbolic links. If
* relative links are not supported on the current
* system, the repository will create absolute links
* instead.
*/
public function __construct($baseDir = '/', $symlink = true, $relative = true)
{
Assert::directory($baseDir);
Assert::boolean($symlink);
$this->baseDir = rtrim(Path::canonicalize($baseDir), '/');
$this->symlink = $symlink && self::isSymlinkSupported();
$this->relative = $this->symlink && $relative;
$this->filesystem = new Filesystem();
}