PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.14
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.14
1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 All 177 releases
disco / app / Analytics / Controllers / SummaryController.php

SummaryController.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.4.14, at app/Analytics/Controllers/SummaryController.php

39 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php //phpcs:ignore
2
3 /**
4 * SummaryController — composes the /analytics/summary response.
5 *
6 * @package Disco
7 * @subpackage Disco\App\Analytics\Controllers
8 * @since 1.3.23
9 */
10
11 namespace Disco\App\Analytics\Controllers;
12
13 use Disco\App\Analytics\Services\SummaryService;
14
15 /**
16 * Resolves periods and delegates to SummaryService.
17 *
18 * No SQL and no query building here — pure orchestration.
19 */
20 class SummaryController extends BaseController {
21
22 /**
23 * Returns the full summary payload for the given request args.
24 *
25 * @param array $args Request args with date_from and date_to as Y-m-d strings (optional).
26 */
27 public static function get_summary( array $args ): array {
28 $current = self::resolve_current_period( $args );
29 $compare = self::resolve_compare_period( $current );
30
31 return array(
32 'current_period' => array( 'from' => $current['from'], 'to' => $current['to'] ),
33 'compare_period' => array( 'from' => $compare['from'], 'to' => $compare['to'] ),
34 'data' => SummaryService::get_summary( $current, $compare ),
35 );
36 }
37
38 }
39