TargetsWpDashboardSetupHook   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getWpDashboardSetupPriority() 0 3 1
A targetWpDashboardSetupHook() 0 10 1
1
<?php
2
3
namespace Leonidas\Hooks;
4
5
use Closure;
6
7
trait TargetsWpDashboardSetupHook
8
{
9
    protected function targetWpDashboardSetupHook()
10
    {
11
        add_action(
12
            "wp_dashboard_setup",
13
            Closure::fromCallable([$this, 'doWpDashboardSetupAction']),
14
            $this->getWpDashboardSetupPriority(),
15
            PHP_INT_MAX
16
        );
17
18
        return $this;
19
    }
20
21
    protected function getWpDashboardSetupPriority(): int
22
    {
23
        return HOOK_DEFAULT_PRIORITY;
24
    }
25
26
    abstract protected function doWpDashboardSetupAction(): void;
27
}
28