1-campaign_type_converter.php 536 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace cx_newsletter;
  3. class campaign_type_converter
  4. extends enum_converter
  5. implements enum_converter_interface {
  6. public function load_string(string $target) : self {
  7. $this->target = match ($target) {
  8. 'SMS' => campaign_type::sms,
  9. 'EMAIL' => campaign_type::email
  10. };
  11. return $this;
  12. }
  13. public function get_string() : string {
  14. return match ($this->target) {
  15. campaign_type::sms => 'SMS',
  16. campaign_type::email => 'EMAIL'
  17. };
  18. }
  19. }