TargetsAllAdminNoticesHook   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

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