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

AbstractSearchCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
dl 0
loc 20
ccs 0
cts 7
cp 0
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A response() 0 3 1
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