PorpaginasAdapter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 17
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSlice() 0 3 1
A getNbResults() 0 3 1
A __construct() 0 3 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