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

Hooks::version()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Elementor;
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('Elementor');
16
            return;
17
        }
18
        $this->hook(Controller::class, [
19
            ['filterElementorPublicInlineScript', 'site-reviews/enqueue/public/inline-script/after', 1],
20
            ['filterElementorStarRatingDefaults', 'site-reviews/defaults/star-rating/defaults'],
21
            ['filterGeneratedSchema', 'site-reviews/schema/generate'],
22
            ['parseElementCss', 'elementor/element/parse_css', 10, 2],
23
            ['registerElementorCategory', 'elementor/elements/categories_registered'],
24
            ['registerElementorWidgets', 'elementor/widgets/register'],
25
            ['registerInlineStyles', 'admin_enqueue_scripts', 20],
26
            ['registerInlineStyles', 'elementor/editor/after_enqueue_styles'],
27
            ['registerInlineStyles', 'elementor/preview/enqueue_styles'],
28
            ['registerScripts', 'elementor/editor/after_enqueue_scripts'],
29
        ]);
30
    }
31
32
    protected function isInstalled(): bool
33
    {
34
        return class_exists('Elementor\Plugin');
35
    }
36
37
    protected function supportedVersion(): string
38
    {
39
        return '3.19.0';
40
    }
41
42
    protected function version(): string
43
    {
44
        return defined('ELEMENTOR_VERSION')
45
            ? (string) \ELEMENTOR_VERSION
46
            : '';
47
    }
48
}
49