Assert\Assertion::choicesNotEmpty PHP Method

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
    public static function choicesNotEmpty(array $values, array $choices, $message = null, $propertyPath = null)
    {
        self::notEmpty($values, $message, $propertyPath);
        foreach ($choices as $choice) {
            self::notEmptyKey($values, $choice, $message, $propertyPath);
        }
        return true;
    }

Usage Example

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;
 }
All Usage Examples Of Assert\Assertion::choicesNotEmpty