Test Failed
Push — develop ( 76157d...9702e2 )
by Paul
08:08
created

UpdateHooks   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 26
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A onInit() 0 6 2
A run() 0 6 1
A levelInit() 0 3 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Hooks;
4
5
use GeminiLabs\SiteReviews\Controllers\UpdateController;
6
7
class UpdateHooks extends AbstractHooks
8
{
9
    public function levelInit(): ?int
10
    {
11
        return 10;
12
    }
13
14
    /**
15
     * @action init:10
16
     */
17
    public function onInit(): void
18
    {
19
        $addons = glsr()->retrieveAs('array', 'licensed', []);
20
        foreach ($addons as $addonId => $addon) {
21
            $this->hook(UpdateController::class, [
22
                ['renderPluginUpdateMessage', "in_plugin_update_message-{$addonId}/{$addonId}.php", 10, 2],
23
            ]);
24
        }
25
    }
26
27
    public function run(): void
28
    {
29
        $this->hook(UpdateController::class, [
30
            ['filterPluginsApi', 'plugins_api', 10, 3],
31
            ['filterUpdatePlugins', 'update_plugins_niftyplugins.com', 10, 2],
32
            ['filterUpdatePluginsTransient', 'site_transient_update_plugins', 50],
33
            // ['onDeleteUpdatePluginsTransient', 'delete_site_transient_update_plugins'],
34
            // ['onUpgraderProcessComplete', 'upgrader_process_complete'],
35
        ]);
36
    }
37
}
38