AbstractConverterObserver   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
c 1
b 0
f 0
dl 0
loc 31
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Converter\AbstractConverterObserver
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 2016 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-converter
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Converter\Observers;
22
23
use TechDivision\Import\Subjects\SubjectInterface;
24
use TechDivision\Import\Observers\AbstractObserver;
25
26
/**
27
 * Abstract import converter implementation.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2016 TechDivision GmbH <[email protected]>
31
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
32
 * @link      https://github.com/techdivision/import-converter
33
 * @link      http://www.techdivision.com
34
 */
35
abstract class AbstractConverterObserver extends AbstractObserver
36
{
37
38
    /**
39
     * Will be invoked by the action on the events the listener has been registered for.
40
     *
41
     * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance
42
     *
43
     * @return array The modified row
44
     * @see \TechDivision\Import\Observers\ObserverInterface::handle()
45
     */
46
    public function handle(SubjectInterface $subject)
47
    {
48
49
        // initialize the row
50
        $this->setSubject($subject);
51
        $this->setRow($subject->getRow());
52
53
        // process the functionality and return the row
54
        $this->process();
55
56
        // return the processed row
57
        return $this->getRow();
58
    }
59
60
    /**
61
     * Process the observer's business logic.
62
     *
63
     * @return void
64
     */
65
    abstract protected function process();
66
}
67