Test Failed
Push — develop ( 2ae3c1...31453c )
by Paul
13:05
created

Hooks::isInstalled()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 5
rs 10
cc 3
nc 3
nop 0
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\YoastSEO;
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', 'wpseo_schema_graph'],
19
        ]);
20
    }
21
22
    protected function isEnabled(): bool
23
    {
24
        return 'yoast_seo' === $this->option('schema.integration.plugin');
25
    }
26
27
    protected function isInstalled(): bool
28
    {
29
        return defined('WPSEO_VERSION')
30
            && function_exists('wpseo_init')
31
            && class_exists('Yoast\WP\SEO\Main');
32
    }
33
}
34