SequentialProcessor::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Processor;
11
12
use Transfer\Adapter\Transaction\Request;
13
use Transfer\Procedure\Procedure;
14
15
/**
16
 * Sequential processor.
17
 */
18
class SequentialProcessor extends EventDrivenProcessor
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23 1
    public function getName()
24
    {
25 1
        return 'Sequential processor';
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 9
    protected function handleProcedure(Procedure $procedure)
32
    {
33 9
        foreach ((array) $procedure->getSources() as $source) {
34 7
            list($adapter, $request) = $source;
35
36 7
            $response = $this->handleSource($adapter, $request);
37
38 6
            $response->getIterator()->rewind();
39
40 6
            while ($object = $this->nextObject($response->getIterator())) {
41
42 6
                $storage = $this->prepareLocalStorage($object);
43
44 6
                $this->handleWorkers($procedure->getWorkers(), $storage);
45
46 6
                $this->handleTargets($procedure->getTargets(), new Request($storage->all()));
47
48 5
                $this->mergeStorage($storage);
49 5
            }
50 7
        }
51 7
    }
52
}
53