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

Searcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 2
b 0
f 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A search() 0 15 2
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