Completed
Push — master ( 4142c5...662dc7 )
by Tim
12s
created

AbstractProcessor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 10
loc 10
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Actions\Processors\ProductPersistProcessor
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
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Actions\Processors;
22
23
/**
24
 * An abstract CRUD processor implementation.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2016 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/techdivision/import
30
 * @link      http://www.techdivision.com
31
 */
32 View Code Duplication
abstract class AbstractProcessor implements ProcessorInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
{
34
35
    /**
36
     * The utility class name with the SQL statements to use.
37
     *
38
     * @var string
39
     */
40
    protected $utilityClassName;
41
42
    /**
43
     * The PDO connection instance.
44
     *
45
     * @var \PDO
46
     */
47
    protected $connection;
48
49
    /**
50
     * Initialize the processor with the passed connection and utility class name.
51
     * .
52
     * @param \PDO   $connection       The PDO connection instance
53
     * @param string $utilityClassName The utility class name
54
     */
55
    public function __construct(\PDO $connection, $utilityClassName)
56
    {
57
58
        // set the passed instances
59
        $this->setConnection($connection);
60
        $this->setUtilityClassName($utilityClassName);
61
62
        // initialize the instance
63
        $this->init();
64
    }
65
66
    /**
67
     * Set's the passed utility class with the SQL statements to use.
68
     *
69
     * @param string $utilityClassName The utility class name
70
     *
71
     * @return void
72
     */
73
    public function setUtilityClassName($utilityClassName)
74
    {
75
        $this->utilityClassName = $utilityClassName;
76
    }
77
78
    /**
79
     * Return's the utility class with the SQL statements to use.
80
     *
81
     * @return string The utility class name
82
     */
83
    public function getUtilityClassName()
84
    {
85
        return $this->utilityClassName;
86
    }
87
88
    /**
89
     * Sets's the initialized PDO connection.
90
     *
91
     * @param \PDO $connection The initialized PDO connection
92
     *
93
     * @return void
94
     */
95
    public function setConnection(\PDO $connection)
96
    {
97
        $this->connection = $connection;
98
    }
99
100
    /**
101
     * Return's the initialized PDO connection.
102
     *
103
     * @return \PDO The initialized PDO connection
104
     */
105
    public function getConnection()
106
    {
107
        return $this->connection;
108
    }
109
}
110