Total Complexity | 7 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | abstract class IntegrationHooks extends AbstractHooks |
||
10 | { |
||
11 | protected function isEnabled(): bool |
||
12 | { |
||
13 | return true; |
||
14 | } |
||
15 | |||
16 | protected function isInstalled(): bool |
||
17 | { |
||
18 | return true; |
||
19 | } |
||
20 | |||
21 | protected function isVersionSupported(): bool |
||
22 | { |
||
23 | $version = glsr(Sanitizer::class)->sanitizeVersion($this->version()); |
||
24 | $supportedVersion = glsr(Sanitizer::class)->sanitizeVersion($this->supportedVersion()); |
||
25 | if (empty($supportedVersion)) { |
||
26 | return true; |
||
27 | } |
||
28 | return version_compare($version, $supportedVersion, '>='); |
||
1 ignored issue
–
show
|
|||
29 | } |
||
30 | |||
31 | protected function notify(string $name): void |
||
32 | { |
||
33 | $notice = _x('Update %s to v%s or higher to enable the integration with Site Reviews.', 'admin-text', 'site-reviews'); |
||
34 | $version = glsr(Sanitizer::class)->sanitizeVersion($this->supportedVersion()); |
||
35 | glsr(Notice::class)->addWarning(sprintf($notice, $name, $version)); |
||
36 | } |
||
37 | |||
38 | protected function supportedVersion(): string |
||
39 | { |
||
40 | return ''; |
||
41 | } |
||
42 | |||
43 | protected function version(): string |
||
46 | } |
||
47 | } |
||
48 |