| Total Complexity | 10 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | class Hooks extends IntegrationHooks |
||
| 8 | { |
||
| 9 | public function run(): void |
||
| 10 | { |
||
| 11 | if (!$this->isInstalled()) { |
||
| 12 | return; |
||
| 13 | } |
||
| 14 | if (!$this->isVersionSupported()) { |
||
| 15 | $this->notify('WPLoyalty'); |
||
| 16 | return; |
||
| 17 | } |
||
| 18 | $this->hook(Controller::class, [ |
||
| 19 | ['filterFieldAfter', 'site-reviews/review-form/fields/visible', 10, 2], |
||
| 20 | ['onApprovedReview', 'site-reviews/review/approved', 20], |
||
| 21 | ['onCreatedReview', 'site-reviews/review/created', 20], |
||
| 22 | ]); |
||
| 23 | } |
||
| 24 | |||
| 25 | protected function isInstalled(): bool |
||
| 26 | { |
||
| 27 | return class_exists('Wlr\App\Helpers\EarnCampaign') |
||
| 28 | && class_exists('\Wlr\App\Helpers\Woocommerce') |
||
| 29 | && class_exists('\Wlr\App\Premium\Helpers\ProductReview') |
||
| 30 | && class_exists('\Wlr\App\Premium\Helpers\Referral'); |
||
| 31 | } |
||
| 32 | |||
| 33 | protected function supportedVersion(): string |
||
| 34 | { |
||
| 35 | return '1.4.0'; |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function version(): string |
||
| 43 | } |
||
| 44 | } |
||
| 45 |