| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- /**
- * Report Factory Class - Creates different types of reports
- *
- * @package StudiouWCCustomReports
- */
- if (!defined('ABSPATH')) {
- exit;
- }
- class StudiouWC_Report_Factory {
-
- private $db_manager;
-
- public function __construct($db_manager) {
- $this->db_manager = $db_manager;
- }
-
- public function create_report($type, $data) {
- switch ($type) {
- case 'product_categories_summary':
- return new StudiouWC_Product_Categories_Report($this->db_manager, $data);
- default:
- throw new InvalidArgumentException("Unknown report type: $type");
- }
- }
-
- public function get_available_report_types() {
- return array(
- 'product_categories_summary' => __('Product Categories and Variants Summary', StudiouWC_Main::get_text_domain())
- );
- }
-
- public function is_valid_report_type($type) {
- $available_types = array_keys($this->get_available_report_types());
- return in_array($type, $available_types);
- }
- }
|