09-activity.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace cx_newsletter;
  3. abstract class activity
  4. extends \cx_appengine\validable_activity {
  5. use activity_toast;
  6. use activity_fail;
  7. use activity_simple_template;
  8. public function __construct(
  9. \wpdb $database,
  10. settings $settings,
  11. \cx_appengine\templates $templates,
  12. table_names $tables
  13. ) {
  14. $this->database = $database;
  15. $this->settings = $settings;
  16. $this->tables = $tables;
  17. $this->error = null;
  18. $this->toast = null;
  19. $this
  20. ->construct_fail()
  21. ->construct_toast()
  22. ->construct_simple_template();
  23. parent::__construct($templates);
  24. }
  25. public static function get_name() : string {
  26. return get_called_class();
  27. }
  28. protected function get_tables() : table_names {
  29. return $this->tables;
  30. }
  31. protected function get_settings() : settings {
  32. return $this->settings;
  33. }
  34. protected function get_database() : \wpdb {
  35. return $this->database;
  36. }
  37. private table_names $tables;
  38. private \wpdb $database;
  39. private settings $settings;
  40. }