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

SearchAuthor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 19 3
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Bricks\Commands;
4
5
use GeminiLabs\SiteReviews\Database;
6
7
class SearchAuthor 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
            ] + $formatted;
26
        }
27
        $this->response = $formatted;
28
    }
29
}
30