Completed
Push — master ( 1e45e0...9c8682 )
by
unknown
17s queued 14s
created

SolrSearchQuery::in()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 1
rs 10
1
<?php
2
3
namespace Kitodo\Dlf\Common;
4
5
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
6
use TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface;
7
use TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface;
8
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
9
10
/**
11
 * Targeted towards being used in ``PaginateController`` (``<f:widget.paginate>``).
12
 */
13
class SolrSearchQuery implements QueryInterface
14
{
15
    public function __construct($solrSearch)
16
    {
17
        $this->solrSearch = $solrSearch;
0 ignored issues
show
Bug Best Practice introduced by
The property solrSearch does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
18
19
        $this->offset = 0;
0 ignored issues
show
Bug Best Practice introduced by
The property offset does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
20
        $this->limit = count($solrSearch);
0 ignored issues
show
Bug Best Practice introduced by
The property limit does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
21
    }
22
23
    public function getSource() {}
24
25
    public function execute($returnRawQueryResult = false)
26
    {
27
        $this->solrSearch->submit($this->offset, $this->limit);
28
29
        // solrSearch now only contains the results in range, indexed in [0, n)
30
        $result = [];
31
        $limit = min($this->limit, $this->solrSearch->getNumLoadedDocuments());
32
        for ($i = 0; $i < $limit; $i++) {
33
            $result[] = $this->solrSearch[$i];
34
        }
35
        return $result;
36
    }
37
38
    public function setOrderings(array $orderings) {}
39
40
    public function setLimit($limit)
41
    {
42
        $this->limit = $limit;
0 ignored issues
show
Bug Best Practice introduced by
The property limit does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
43
        return $this;
44
    }
45
46
    public function setOffset($offset)
47
    {
48
        $this->offset = $offset;
0 ignored issues
show
Bug Best Practice introduced by
The property offset does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
49
        return $this;
50
    }
51
52
    public function matching($constraint) {}
53
    public function logicalAnd($constraint1) {}
54
    public function logicalOr($constraint1) {}
55
    public function logicalNot(ConstraintInterface $constraint) {}
56
    public function equals($propertyName, $operand, $caseSensitive = true) {}
57
    public function like($propertyName, $operand) {}
58
    public function contains($propertyName, $operand) {}
59
    public function in($propertyName, $operand) {}
60
    public function lessThan($propertyName, $operand) {}
61
    public function lessThanOrEqual($propertyName, $operand) {}
62
    public function greaterThan($propertyName, $operand) {}
63
    public function greaterThanOrEqual($propertyName, $operand) {}
64
    public function getType() {}
65
    public function setQuerySettings(QuerySettingsInterface $querySettings) {}
66
    public function getQuerySettings() {}
67
68
    public function count()
69
    {
70
        // TODO?
71
    }
72
73
    public function getOrderings() {}
74
75
    public function getLimit()
76
    {
77
        return $this->limit;
78
    }
79
80
    public function getOffset()
81
    {
82
        return $this->offset;
83
    }
84
85
    public function getConstraint() {}
86
    public function isEmpty($propertyName) {}
87
    public function setSource(SourceInterface $source) {}
88
    public function getStatement() {}
89
}
90