Passed
Push — develop ( 39ad60...0ca1de )
by Paul
14:09
created

AbstractSearchCommand::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 1
b 0
f 0
cc 2
nc 1
nop 0
crap 6
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Bricks\Commands;
4
5
use GeminiLabs\SiteReviews\Commands\AbstractCommand;
6
use GeminiLabs\SiteReviews\Integrations\Bricks\Concerns\ManagesBricksAjax;
7
8
abstract class AbstractSearchCommand extends AbstractCommand
9
{
10
    use ManagesBricksAjax;
11
12
    public array $include;
13
    public string $search;
14
15
    protected array $response = [];
16
17
    public function __construct()
18
    {
19
        $rawInclude = filter_input(\INPUT_GET, 'include', \FILTER_DEFAULT, \FILTER_FORCE_ARRAY);
20
        $rawSearch = filter_input(\INPUT_GET, 'search', \FILTER_SANITIZE_STRING);
21
        $this->include = $rawInclude ?? [];
22
        $this->search = stripslashes_deep(sanitize_text_field($rawSearch ?: ''));
23
    }
24
25
    public function response(): array
26
    {
27
        return $this->response;
28
    }
29
}
30