| 1 |
<?php |
| 2 |
|
| 3 |
namespace Monei\Features\Subscriptions; |
| 4 |
|
| 5 |
use WC_Order; |
| 6 |
|
| 7 |
class SubscriptionService { |
| 8 |
|
| 9 |
private $wooHandler; |
| 10 |
private $yithHandler; |
| 11 |
|
| 12 |
public function __construct( WooCommerceSubscriptionsHandler $wooHandler, YithSubscriptionPluginHandler $yithHandler ) { |
| 13 |
$this->wooHandler = $wooHandler; |
| 14 |
$this->yithHandler = $yithHandler; |
| 15 |
} |
| 16 |
|
| 17 |
public function getHandler(): ?SubscriptionHandlerInterface { |
| 18 |
if ( $this->wooHandler->is_subscriptions_addon_enabled() ) { |
| 19 |
return $this->wooHandler; |
| 20 |
} |
| 21 |
|
| 22 |
if ( $this->yithHandler->is_subscriptions_addon_enabled() ) { |
| 23 |
return $this->yithHandler; |
| 24 |
} |
| 25 |
|
| 26 |
return null; |
| 27 |
} |
| 28 |
} |
| 29 |
|