Completed
Push — master ( 69b436...e84470 )
by Kirill
14:54 queued 05:27
created

Builder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 24
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A nothing() 0 6 2
A extractResult() 0 6 1
1
<?php
2
/**
3
 * This file is part of Hydrogen package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace RDS\Hydrogen\Processor\DatabaseProcessor;
11
12
use RDS\Hydrogen\Processor\BuilderInterface;
13
14
/**
15
 * Class Builder
16
 */
17
abstract class Builder implements BuilderInterface
18
{
19
    /**
20
     * @return \Generator
21
     */
22 4
    protected function nothing(): \Generator
23
    {
24 4
        if (false) {
25
            yield;
26
        }
27 4
    }
28
29
    /**
30
     * @param \Generator $generator
31
     * @param \Closure $then
32
     * @return \Generator
33
     */
34 8
    protected function extractResult(\Generator $generator, \Closure $then): \Generator
35
    {
36 8
        yield from $generator;
37
38 8
        $then($generator->getReturn());
39 8
    }
40
}
41