Completed
Pull Request — master (#14)
by Саша
02:04
created

QueuedPipeline   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 2
c 5
b 0
f 1
lcom 1
cbo 4
dl 0
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A process() 0 16 1
1
<?php
2
3
namespace Extraload\Pipeline;
4
5
use Extraload\Extractor\QueuedExtractor;
6
use Extraload\Transformer\QueuedTransformer;
7
use Extraload\Loader\QueuedLoader;
8
use Ko\ProcessManager;
9
use Ko\Process;
10
11
class QueuedPipeline implements PipelineInterface
12
{
13
    private $extractor;
14
    private $transformer;
15
    private $loader;
16
    private $processManager;
17
18
    public function __construct(
19
        QueuedExtractor $extractor,
20
        QueuedTransformer $transformer,
21
        QueuedLoader $loader,
22
        ProcessManager $processManager
23
    )
24
    {
25
        $this->extractor = $extractor;
26
        $this->transformer = $transformer;
27
        $this->loader = $loader;
28
        $this->processManager = $processManager;
29
    }
30
31
    public function process()
32
    {
33
        $this->processManager->fork(function(Process $process) {
0 ignored issues
show
Unused Code introduced by
The parameter $process is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
34
            $this->extractor->extract();
35
        });
36
37
        $this->processManager->fork(function(Process $process) {
0 ignored issues
show
Unused Code introduced by
The parameter $process is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
            $this->transformer->transform();
39
        });
40
41
        $this->processManager->fork(function(Process $process) {
0 ignored issues
show
Unused Code introduced by
The parameter $process is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
            $this->loader->load();
43
        });
44
45
        $this->processManager->wait();
46
    }
47
}
48