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

QueuedPipeline::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 9
nc 1
nop 4
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