Passed
Push — hotfix/fix-counts ( 4b43d1...cc9e05 )
by Paul
03:52
created

Metaboxes::saveResponseMetabox()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.5

Importance

Changes 0
Metric Value
cc 2
eloc 7
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 10
ccs 3
cts 6
cp 0.5
crap 2.5
rs 10
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Controllers\EditorController;
4
5
use GeminiLabs\SiteReviews\Helper;
6
7
class Metaboxes
8
{
9
    /**
10
     * @param int $postId
11
     * @return void
12
     */
13 1
    public function saveAssignedToMetabox($postId)
14
    {
15 1
        if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-assigned-to'), 'assigned_to')) {
16 1
            return;
17
        }
18
        $assignedTo = strval(glsr(Helper::class)->filterInput('assigned_to'));
19
        update_post_meta($postId, 'assigned_to', $assignedTo);
20
    }
21
22
    /**
23
     * @param int $postId
24
     * @return mixed
25
     */
26 1
    public function saveResponseMetabox($postId)
27
    {
28 1
        if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-response'), 'response')) {
29 1
            return;
30
        }
31
        $response = strval(glsr(Helper::class)->filterInput('response'));
32
        update_post_meta($postId, 'response', trim(wp_kses($response, [
33
            'a' => ['href' => [], 'title' => []],
34
            'em' => [],
35
            'strong' => [],
36
        ])));
37
    }
38
}
39