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

org_openpsa_qbpager_direct::count_unchecked()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 6
rs 10
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