本文整理匯總了PHP中Assert\Assertion::allInArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assertion::allInArray方法的具體用法?PHP Assertion::allInArray怎麽用?PHP Assertion::allInArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::allInArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: guardOptions
private function guardOptions($options, $constraints)
{
Assertion::allInArray(array_keys($options), array_keys($constraints));
foreach ($options as $key => $value) {
$constraint = $constraints[$key];
if (is_callable($constraint)) {
call_user_func($constraint, $value);
}
}
}
示例2: validate
private function validate()
{
Assertion::nullOrString($this->logMessageRegExp);
Assertion::nullOrString($this->logMessageInString);
Assertion::nullOrString($this->logContextFuzzy);
Assertion::nullOrIsInstanceOf($this->logTimeLowerBounds, DateTimeInterface::class);
Assertion::nullOrIsInstanceOf($this->logTimeUpperBounds, DateTimeInterface::class);
Assertion::nullOrIsArray($this->logLevelList);
if (!is_null($this->logLevelList)) {
Assertion::notEmpty($this->logLevelList);
Assertion::allInArray($this->logLevelList, array_values((new ReflectionClass(LogLevel::class))->getConstants()));
}
if (!is_null($this->logMessageRegExp)) {
Assertion::true(RegexGuardFactory::getGuard()->isRegexValid($this->logMessageRegExp));
}
if (!is_null($this->logTimeLowerBounds) && !is_null($this->logTimeUpperBounds)) {
Assertion::false($this->logTimeLowerBounds->diff($this->logTimeUpperBounds)->invert);
}
}
示例3: validateNames
/**
* @Then I should see the following names:
*
* @param TableNode $table
*/
public function validateNames(TableNode $table)
{
$list = array_column($table->getHash(), 'username');
Assertion::allInArray($this->filterResult, $list);
Assertion::count($this->filterResult, count($list));
}