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

SearchAssignedUsers::handle()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 21
ccs 0
cts 18
cp 0
rs 9.7666
c 1
b 0
f 0
cc 3
nc 4
nop 0
crap 12
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Bricks\Commands;
4
5
use GeminiLabs\SiteReviews\Database;
6
7
class SearchAssignedUsers extends AbstractSearchCommand
8
{
9
    public function handle(): void
10
    {
11
        $this->verifyNonce();
12
        $results = glsr(Database::class)->users([
13
            'number' => 25,
14
            'search_wild' => $this->search,
15
        ]);
16
        if ($missingIds = $this->missingIds($results, $this->include)) {
17
            $results += glsr(Database::class)->users([
18
                'include' => $missingIds,
19
            ]);
20
        }
21
        $formatted = $this->formatResults($results);
22
        if (empty($this->search)) {
23
            $formatted = [
24
                'user_id' => esc_html_x('The Logged In User', 'admin-text', 'site-reviews'),
25
                'author_id' => esc_html_x('The Page Author', 'admin-text', 'site-reviews'),
26
                'profile_id' => esc_html_x('The Profile User', 'admin-text', 'site-reviews'),
27
            ] + $formatted;
28
        }
29
        $this->response = $formatted;
30
    }
31
}
32