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

SearchAssignedUsers   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 21 3
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