AdminBar.php
2 days ago
AdminBarEditColumns.php
2 days ago
Colors.php
2 days ago
CommonAssets.php
2 days ago
CurrentTable.php
2 days ago
ManageHeadings.php
2 days ago
ManageValue.php
2 days ago
NoticeChecks.php
2 days ago
PluginUpdate.php
2 days ago
PromoChecks.php
2 days ago
QuickEdit.php
2 days ago
SaveHeadings.php
2 days ago
Setup.php
2 days ago
TableRows.php
2 days ago
Tooltips.php
2 days ago
View.php
2 days ago
PromoChecks.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Service; |
| 6 | |
| 7 | use AC; |
| 8 | use AC\Check\Promotion; |
| 9 | |
| 10 | class PromoChecks implements AC\Registerable |
| 11 | { |
| 12 | private AC\Promo\PromoRepository $repository; |
| 13 | |
| 14 | private AC\Preferences\UserFactory $preference_factory; |
| 15 | |
| 16 | public function __construct(AC\Promo\PromoRepository $repository, AC\Preferences\UserFactory $preference_factory) |
| 17 | { |
| 18 | $this->repository = $repository; |
| 19 | $this->preference_factory = $preference_factory; |
| 20 | } |
| 21 | |
| 22 | public function register(): void |
| 23 | { |
| 24 | $promo = $this->repository->find_active(); |
| 25 | |
| 26 | if (! $promo) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | $service = new Promotion($promo, $this->preference_factory); |
| 31 | $service->register(); |
| 32 | } |
| 33 | |
| 34 | } |
| 35 |