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

SearchAssignedTerms::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 13
ccs 0
cts 11
cp 0
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Bricks\Commands;
4
5
use GeminiLabs\SiteReviews\Database;
6
7
class SearchAssignedTerms extends AbstractSearchCommand
8
{
9
    public function handle(): void
10
    {
11
        $this->verifyNonce();
12
        $results = glsr(Database::class)->terms([
13
            'number' => 25,
14
            'search' => $this->search,
15
        ]);
16
        if ($missingIds = $this->missingIds($results, $this->include)) {
17
            $results += glsr(Database::class)->terms([
18
                'term_taxonomy_id' => $missingIds,
19
            ]);
20
        }
21
        $this->response = $this->formatResults($results);
22
    }
23
}
24