Completed
Push — master ( b5c840...3d5461 )
by Marcus
04:46
created

YieldedFinder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 23
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A find() 0 12 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Repositories\Finders\YieldedFinder
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2019 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Repositories\Finders;
22
23
/**
24
 * Yielded finder implementation.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2019 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/techdivision/import
30
 * @link      http://www.techdivision.com
31
 */
32
class YieldedFinder extends SimpleFinder
33
{
34
35
    /**
36
     * Executes the finder with the passed parameters.
37
     *
38
     * @param array $params The finder params
39
     *
40
     * @return array The finder result
41
     */
42
    public function find(array $params = array())
43
    {
44
45
        // execute the prepared statement
46
        $this->preparedStatement->execute($params);
47
48
        // fetch the values and return them
49
        while ($record = $this->preparedStatement->fetch(\PDO::FETCH_ASSOC)) {
50
            // return the record
51
            yield $record;
52
        }
53
    }
54
}
55