choicesNotEmpty() public static method

Determines if the values array has every choice as key and that this choice has content.
public static choicesNotEmpty ( array $values, array $choices, null $message = null, null $propertyPath = null ) : boolean
$values array
$choices array
$message null
$propertyPath null
return boolean
Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 /**
  * {@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());
 }
 /**
  * {@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;
 }
Exemplo n.º 4
0
 /**
  * @dataProvider invalidChoicesProvider
  */
 public function testChoicesNotEmptyExpectingException($values, $choices, $exceptionCode)
 {
     $this->setExpectedException('Assert\\AssertionFailedException', null, $exceptionCode);
     Assertion::choicesNotEmpty($values, $choices);
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     Assertion::choicesNotEmpty($data, ['name', 'arguments']);
     return new DefaultMessage($data['name'], $data['arguments']);
 }