Passed
Push — master ( 90ece2...a7cb98 )
by Fabrice
08:54 queued 05:47
created

NullExtractor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 33
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A extract() 0 7 2
A getExtracted() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of YaEtl
5
 *     (c) Fabrice de Stefanis / https://github.com/fab2s/YaEtl
6
 * This source file is licensed under the MIT license which you will
7
 * find in the LICENSE file or at https://opensource.org/licenses/MIT
8
 */
9
10
namespace fab2s\YaEtl\Extractors;
11
12
/**
13
 * Class NullExtractor
14
 */
15
class NullExtractor extends ExtractorBatchLimitAbstract
16
{
17
    /**
18
     * Total number of records to fetch
19
     *
20
     * @var int
21
     */
22
    protected $limit = 50;
23
24
    /**
25
     * Triggers an extract
26
     *
27
     * @param mixed $param
28
     *
29
     * @return bool
30
     */
31
    public function extract($param = null): bool
32
    {
33
        if ($this->numRecords >= $this->limit) {
34
            return false;
35
        }
36
37
        return true;
38
    }
39
40
    /**
41
     * Return the dumbest Generator ever
42
     *
43
     * @return \Generator
44
     */
45
    public function getExtracted(): iterable
46
    {
47
        yield null;
48
    }
49
}
50