Passed
Push — master ( 0db885...0de6e6 )
by Petr
08:07
created

THelpingText::getFilledText()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 6
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 3
rs 10
1
<?php
2
3
namespace kalanis\kw_paging\Traits;
4
5
6
use kalanis\kw_paging\Interfaces\IPositions;
7
8
9
/**
10
 * Trait THelpingText
11
 * @package kalanis\kw_paging\Render\SimplifiedPager
12
 * Trait for render simple helping text about
13
 */
14
trait THelpingText
15
{
16
    use TLang;
17
18 14
    public function getFilledText(?IPositions $positions): string
19
    {
20 14
        if (!$this->kpgLang || !$positions) {
21 1
            return '';
22
        }
23 14
        return $this->getKpgLang()->kpgShowResults(
24 14
            $positions->getPager()->getOffset() + 1,
25 14
            min($positions->getPager()->getOffset() + $positions->getPager()->getLimit(), $positions->getPager()->getMaxResults()),
26 14
            $positions->getPager()->getMaxResults()
27
        );
28
    }
29
}
30