Passed
Pull Request — master (#4)
by Gordon
08:08
created

Searcher::search()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 15
rs 9.9666
cc 2
nc 2
nop 1
1
<?php declare(strict_types = 1);
2
3
/**
4
 * Created by PhpStorm.
5
 * User: gordon
6
 * Date: 24/3/2561
7
 * Time: 20:36 น.
8
 */
9
10
namespace Suilven\FreeTextSearch\Tests\Mock;
11
12
use Suilven\FreeTextSearch\Base\SearcherBase;
13
14
class Searcher extends SearcherBase
15
{
16
    /** @return array<string,array<string,string>> */
17
    public function search(string $q): array
18
    {
19
        \error_log('***** MOCK SEARCH *****');
20
21
        $result = [];
22
        switch ($q) {
23
            case 'Fish':
24
                $result = [
25
                    'Title' => 'Fishing in New Zealand',
26
                ];
27
                $result['ResultsFound'] = 1;
28
                $result['AllFacets'] = [];
29
        }
30
31
        return $result;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $result returns an array which contains values of type string which are incompatible with the documented value type array<string,string>.
Loading history...
32
    }
33
}
34