PorpaginasAdapter::getNbResults()   A
last analyzed

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
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace Zenstruck\Porpaginas\Bridge\Pagerfanta;
4
5
use Pagerfanta\Adapter\AdapterInterface;
6
use Zenstruck\Porpaginas\Result;
7
8
final class PorpaginasAdapter implements AdapterInterface
9
{
10
    private Result $result;
11
12 2
    public function __construct(Result $result)
13
    {
14 2
        $this->result = $result;
15 2
    }
16
17 2
    public function getNbResults(): int
18
    {
19 2
        return $this->result->count();
20
    }
21
22 1
    public function getSlice($offset, $length): iterable
23
    {
24 1
        return $this->result->take($offset, $length);
25
    }
26
}
27