Passed
Push — master ( ece31d...41b8a6 )
by Paul
10:20 queued 04:17
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\Database;
6
use GeminiLabs\SiteReviews\Helper;
7
8
class Metaboxes
9
{
10
    /**
11
     * @param int $postId
12
     * @return void
13
     */
14 1
    public function saveAssignedToMetabox($postId)
15
    {
16 1
        if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-assigned-to'), 'assigned_to')) {
17 1
            return;
18
        }
19
        $assignedTo = strval(glsr(Helper::class)->filterInput('assigned_to'));
20
        glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
21
    }
22
23
    /**
24
     * @param int $postId
25
     * @return mixed
26
     */
27 1
    public function saveResponseMetabox($postId)
28
    {
29 1
        if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-response'), 'response')) {
30 1
            return;
31
        }
32
        $response = strval(glsr(Helper::class)->filterInput('response'));
33
        glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
34
            'a' => ['href' => [], 'title' => []],
35
            'em' => [],
36
            'strong' => [],
37
        ])));
38
    }
39
}
40