Passed
Push — master ( 8b441d...0083f3 )
by Andreas
17:38
created

org_openpsa_qbpager_direct::_prepare_qbs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package org.openpsa.qbpager
4
 */
5
/**
6
 * Pages QB resultsets (uses midgard QB directly)
7
 *
8
 * @package org.openpsa.qbpager
9
 */
10
class org_openpsa_qbpager_direct extends org_openpsa_qbpager
11
{
12 1
    protected function _prepare_qbs(string $classname)
13
    {
14 1
        $this->_midcom_qb = new midgard_query_builder($classname);
15
        // Make another QB for counting, we need to do this to avoid trouble with core internal references system
16 1
        $this->_midcom_qb_count = new midgard_query_builder($classname);
17 1
    }
18
19
    /**
20
     * Wraps to execute since this is what midcom QB does, too
21
     */
22 1
    public function execute_unchecked() : array
23
    {
24 1
        return $this->execute();
25
    }
26
27
    /**
28
     * Wraps to count since this is what midcom QB does, too
29
     */
30
    public function count_unchecked() : int
31
    {
32
        if (!$this->count) {
33
            $this->count = $this->_midcom_qb_count->count();
34
        }
35
        return $this->count;
36
    }
37
}
38