Questionaire.php 657 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace DNB;
  3. class Questionaire extends AbstractPostSerializable implements PostSerializableInterface {
  4. public function __construct(
  5. private ?bool $keepMeInformedOnBids = null,
  6. private ?bool $contactForPropertyValuation = null,
  7. private ?bool $contactForEconomicalAdvice = null,
  8. ){}
  9. public function toPostParams(): array {
  10. $arr = [];
  11. foreach (static::getClassVars() as $key)
  12. $arr[$key] = !is_null($this->{$key}) ? $this->{$key} : false;
  13. return $arr;
  14. }
  15. protected static function getClassVars(): array {
  16. return array_keys(get_class_vars(__CLASS__));
  17. }
  18. }