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

SolrSearchQuery   A

Complexity

Total Complexity 30

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 76
rs 10
wmc 30

29 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 2
A contains() 0 1 1
A matching() 0 1 1
A getQuerySettings() 0 1 1
A setLimit() 0 4 1
A greaterThan() 0 1 1
A __construct() 0 6 1
A setSource() 0 1 1
A lessThan() 0 1 1
A getOffset() 0 3 1
A getStatement() 0 1 1
A getType() 0 1 1
A equals() 0 1 1
A setOrderings() 0 1 1
A logicalOr() 0 1 1
A logicalNot() 0 1 1
A lessThanOrEqual() 0 1 1
A setOffset() 0 4 1
A getSource() 0 1 1
A in() 0 1 1
A count() 0 2 1
A getLimit() 0 3 1
A logicalAnd() 0 1 1
A getConstraint() 0 1 1
A setQuerySettings() 0 1 1
A greaterThanOrEqual() 0 1 1
A like() 0 1 1
A getOrderings() 0 1 1
A isEmpty() 0 1 1
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