Passed
Push — master ( ece31d...41b8a6 )
by Paul
10:20 queued 04:17
created

Metaboxes   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 29
ccs 6
cts 12
cp 0.5
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A saveResponseMetabox() 0 10 2
A saveAssignedToMetabox() 0 7 2
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