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

SearchQuery::addSearchTerm()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 6
rs 10
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