Passed
Push — hotfix/fix-counts ( 4b43d1...cc9e05 )
by Paul
03:52
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\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