Passed
Push — master ( 0083f3...057072 )
by Andreas
17:57
created

org_openpsa_qbpager_direct::execute_unchecked()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
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 count since this is what midcom QB does, too
21
     */
22
    public function count_unchecked() : int
23
    {
24
        if (!$this->count) {
25
            $this->count = $this->_midcom_qb_count->count();
26
        }
27
        return $this->count;
28
    }
29
}
30