本文整理匯總了PHP中Assert\Assertion::choicesNotEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assertion::choicesNotEmpty方法的具體用法?PHP Assertion::choicesNotEmpty怎麽用?PHP Assertion::choicesNotEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::choicesNotEmpty方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param string|integer $id
* @param array $data
*/
public function __construct($id, $data)
{
// TODO: check for id's type
Assertion::choicesNotEmpty($data, ['username', 'password']);
$this->id = $id;
$this->data = $data;
}
示例2: authenticate
/**
* {@inheritdoc}
*/
public function authenticate($subject, Caller $caller)
{
Assertion::isArray($subject);
Assertion::choicesNotEmpty($subject, ['password']);
Assertion::isInstanceOf($caller, 'Guardian\\User\\Caller', sprintf('The caller was expected to be an instance of "%s"', 'Indigo\\Guardian\\Caller\\User'));
return $this->hasher->verify($subject['password'], $caller->getPassword());
}
示例3: denormalize
/**
* {@inheritDoc}
*/
public function denormalize($data, $class, $format = null, array $context = [])
{
Assertion::choicesNotEmpty($data, ['message', 'class', 'timestamp']);
Assertion::classExists($data['class']);
$envelope = new Envelope($this->aggregate->denormalize($data['message'], $data['class']));
$this->forcePropertyValue($envelope, 'class', $data['class']);
$this->forcePropertyValue($envelope, 'timestamp', $data['timestamp']);
return $envelope;
}
示例4: testChoicesNotEmptyExpectingException
/**
* @dataProvider invalidChoicesProvider
*/
public function testChoicesNotEmptyExpectingException($values, $choices, $exceptionCode)
{
$this->setExpectedException('Assert\\AssertionFailedException', null, $exceptionCode);
Assertion::choicesNotEmpty($values, $choices);
}
示例5: denormalize
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = null, array $context = [])
{
Assertion::choicesNotEmpty($data, ['name', 'arguments']);
return new DefaultMessage($data['name'], $data['arguments']);
}