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

UpdateHooks::hasInit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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