Passed
Pull Request — main (#19)
by
unknown
08:15 queued 06:23
created

ResultsGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types=1);
9
10
namespace loophp\iterators\Pagination;
11
12
use Closure;
13
use loophp\iterators\Contract\Pagination\ResultsGeneratorInterface;
14
15
/**
16
 * @template T
17
 *
18
 * @implements ResultsGeneratorInterface<T>
19
 *
20
 * @immutable
21
 */
22
final class ResultsGenerator implements ResultsGeneratorInterface
23
{
24
    /**
25
     * @var Closure(int): T
26
     */
27
    private Closure $generator;
28
29
    /**
30
     * @param Closure(int): T $generator
31
     */
32
    public function __construct(Closure $generator)
33
    {
34
        $this->generator = $generator;
35
    }
36
37
    /**
38
     * @return T
0 ignored issues
show
Bug introduced by
The type loophp\iterators\Pagination\T was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
     */
40
    public function __invoke(int $page = 0)
41
    {
42
        return ($this->generator)($page);
43
    }
44
}
45