Passed
Push — master ( 342193...f80fe6 )
by Andrea Marco
03:14 queued 11s
created

Macro   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 2
b 0
f 0
dl 0
loc 14
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
1
<?php
2
3
namespace Cerbero\LazyJsonPages;
4
5
use Illuminate\Support\LazyCollection;
6
7
/**
8
 * The lazy collection macro.
9
 *
10
 */
11
class Macro
12
{
13
    /**
14
     * Load paginated items of the given JSON source in a lazy collection
15
     *
16
     * @param \Psr\Http\Message\RequestInterface|\Illuminate\Http\Client\Response $source
17
     * @param string $path
18
     * @param callable|array|string|int $config
19
     * @return LazyCollection
20
     */
21 14
    public function __invoke($source, string $path, $config): LazyCollection
22
    {
23 14
        return new LazyCollection(function () use ($source, $path, $config) {
24 14
            yield from new Source($source, $path, $config);
25 14
        });
26
    }
27
}
28