本文整理汇总了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']);
}