Completed
Pull Request — master (#51)
by
unknown
01:33
created

helpers.php ➔ csp_attr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
if (! function_exists('csp_nonce')) {
4
    function csp_nonce(): string
5
    {
6
        return app('csp-nonce');
7
    }
8
}
9
10
11
if (! function_exists('csp_attr')) {
12
    function csp_attr(): \Illuminate\Support\HtmlString
13
    {
14
            $nonce = csp_nonce();
15
            return new \Illuminate\Support\HtmlString(sprintf('nonce="%s"', e($nonce)));
16
17
    }
18
}
19