getStyleLoaderTagCallback()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Leonidas\Hooks;
4
5
use Closure;
6
7
trait TargetsStyleLoaderTagHook
8
{
9
    protected function targetStyleLoaderTagHook()
10
    {
11
        add_filter(
12
            'style_loader_tag',
13
            $this->getStyleLoaderTagCallback(),
14
            10,
15
            PHP_INT_MAX
16
        );
17
18
        return $this;
19
    }
20
21
    protected function getStyleLoaderTagCallback(): Closure
22
    {
23
        return function (string $tag, string $handle, string $href, string $media) {
24
            return $this->filterStyleLoaderTag($tag, $handle, $href, $media);
25
        };
26
    }
27
28
    abstract protected function filterStyleLoaderTag(string $tag, string $handle, string $href, string $media): string;
29
}
30