Passed
Push — master ( 3384db...78f140 )
by Paul
04:58
created

CreateReview   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 35
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 2
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Commands;
4
5
use GeminiLabs\SiteReviews\Helper;
6
7
class CreateReview
8
{
9
	public $ajaxRequest;
10
	public $assignedTo;
11
	public $author;
12
	public $blacklisted;
13
	public $category;
14
	public $content;
15
	public $email;
16
	public $formId;
17
	public $ipAddress;
18
	public $rating;
19
	public $referrer;
20
	public $request;
21
	public $terms;
22
	public $title;
23
24
	public function __construct( $input )
25
	{
26
		$this->ajaxRequest = isset( $input['ajax_request'] );
27
		$this->assignedTo = is_numeric( $input['assign_to'] )
28
			? $input['assign_to']
29
			: '';
30
		$this->author = sanitize_text_field( $input['name'] );
31
		$this->blacklisted = false;
32
		$this->category = sanitize_key( $input['category'] );
33
		$this->content = sanitize_textarea_field( $input['content'] );
34
		$this->email = sanitize_email( $input['email'] );
35
		$this->formId = sanitize_key( $input['id'] );
36
		$this->ipAddress = glsr( Helper::class )->getIpAddress();
37
		$this->rating = intval( $input['rating'] );
38
		$this->referrer = $input['_wp_http_referer'];
39
		$this->request = $input;
40
		$this->terms = isset( $input['terms'] );
41
		$this->title = sanitize_text_field( $input['title'] );
42
	}
43
}
44