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

Hooks   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
eloc 9
dl 0
loc 23
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 3
A isEnabled() 0 3 1
A isInstalled() 0 3 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\SASWP;
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->isEnabled()) {
15
            return;
16
        }
17
        $this->hook(Controller::class, [
18
            ['filterSchema', 'saswp_modify_reviews_schema', 20],
19
        ]);
20
    }
21
22
    protected function isEnabled(): bool
23
    {
24
        return 'saswp' === $this->option('schema.integration.plugin');
25
    }
26
27
    protected function isInstalled(): bool
28
    {
29
        return defined('SASWP_VERSION');
30
    }
31
}
32