32 lines
656 B
PHP
32 lines
656 B
PHP
<?php declare(strict_types = 1);
|
|
|
|
namespace MailPoet\Automation\Integrations\WooCommerce;
|
|
|
|
if (!defined('ABSPATH')) exit;
|
|
|
|
|
|
class ContextFactory {
|
|
|
|
/** @var WooCommerce */
|
|
private $woocommerce;
|
|
|
|
public function __construct(
|
|
WooCommerce $woocommerce
|
|
) {
|
|
$this->woocommerce = $woocommerce;
|
|
}
|
|
|
|
/** @return mixed[] */
|
|
public function getContextData(): array {
|
|
|
|
if (!$this->woocommerce->isWooCommerceActive()) {
|
|
return [];
|
|
}
|
|
|
|
$context = [
|
|
'order_statuses' => $this->woocommerce->wcGetOrderStatuses(),
|
|
'review_ratings_enabled' => $this->woocommerce->wcReviewRatingsEnabled(),
|
|
];
|
|
return $context;
|
|
}
|
|
}
|