Test Failed
Push — develop ( 1da57b...1707fa )
by Paul
07:25
created

Hooks::unsupportedVersionNotice()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 8
rs 10
cc 2
nc 1
nop 0
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\FusionBuilder;
4
5
use GeminiLabs\SiteReviews\Integrations\IntegrationHooks;
6
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('Fusion Builder');
16
            return;
17
        }
18
        $this->hook(Controller::class, [
19
            ['enqueueBuilderStyles', 'fusion_builder_enqueue_live_scripts'],
20
            ['filterButtonClass', 'site-reviews/defaults/style-classes/defaults'],
21
            ['filterPublicInlineScript', 'site-reviews/enqueue/public/inline-script/after'],
22
            ['onActivated', 'site-reviews/activated'],
23
            ['registerFusionElements', 'fusion_builder_before_init'],
24
        ]);
25
    }
26
27
    protected function isInstalled(): bool
28
    {
29
        return class_exists('FusionBuilder') && defined('FUSION_BUILDER_VERSION');
30
    }
31
32
    protected function supportedVersion(): string
33
    {
34
        return '3.11.0';
35
    }
36
37
    protected function version(): string
38
    {
39
        if (defined('FUSION_BUILDER_VERSION')) {
40
            return (string) \FUSION_BUILDER_VERSION;
41
        }
42
        return '';
43
    }
44
}
45