Test Failed
Push — master ( 50dd93...f69d16 )
by Chris
12:03
created

TargetsInAdminHeaderHook   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
c 0
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A targetInAdminHeaderHook() 0 10 1
A getInAdminHeaderCallback() 0 4 1
1
<?php
2
3
namespace Leonidas\Hooks;
4
5
use Closure;
6
7
trait TargetsInAdminHeaderHook
8
{
9
    protected function targetInAdminHeaderHook()
10
    {
11
        add_action(
12
            'in_admin_header',
13
            $this->getInAdminHeaderCallback(),
14
            10,
15
            PHP_INT_MAX
16
        );
17
18
        return $this;
19
    }
20
21
    protected function getInAdminHeaderCallback(): Closure
22
    {
23
        return function () {
24
            $this->doInAdminHeaderAction();
25
        };
26
    }
27
28
    abstract protected function doInAdminHeaderAction(): void;
29
}
30