Passed
Push — master ( ca7c80...db53dd )
by Simon
09:23
created

SearchQuery   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addSearchTerm() 0 6 2
A getLimit() 0 3 1
A setLimit() 0 4 1
1
<?php
2
3
namespace SilverStripe\FullTextSearch\Search\Queries;
4
5
use Firesphere\SolrSearch\Queries\BaseQuery;
6
7
/**
8
 * Class SearchQuery
9
 * Cover any changes between the SilverStripe FulltextSearch module and the upgraded module
10
 * @package SilverStripe\FullTextSearch\Search\Queries
11
 */
12
class SearchQuery extends BaseQuery
13
{
14
    /**
15
     * @var int Default page size
16
     */
17
    public static $default_page_size = 10;
18
19
    /**
20
     * A simple stub to cover changes between Solr Search modules
21
     * @deprecated please use {@link self::addTerm()}
22
     * @param string $text
23
     * @param null|array $fields
24
     * @param array $boost
25
     * @return $this
26
     */
27
    public function addSearchTerm($text, $fields = [], $boost = [])
28
    {
29
        $fields = $fields ? (array)$fields : [];
30
        $this->addTerm($text, $fields, $boost);
0 ignored issues
show
Bug introduced by
$boost of type array is incompatible with the type integer expected by parameter $boost of Firesphere\SolrSearch\Queries\BaseQuery::addTerm(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        $this->addTerm($text, $fields, /** @scrutinizer ignore-type */ $boost);
Loading history...
31
32
        return $this;
33
    }
34
35
    /**
36
     * Set the rows that are to be returned
37
     * Compatibility stub
38
     * @param int $limit
39
     * @return $this
40
     */
41
    public function setLimit($limit): self
42
    {
43
        $this->rows = $limit;
44
        return $this;
45
    }
46
47
    /**
48
     * Get the rows that are to be returned
49
     * Compatibility stub
50
     * @return int
51
     */
52
    public function getLimit(): int
53
    {
54
        return $this->rows;
55
    }
56
57
}
58