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

TargetsEditFormTopHook   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

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