Completed
Push — master ( 8f7f35...24dda9 )
by Tim
04:15 queued 02:31
created

AbstractAction::getUpdateProcessor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Actions\AbstractAction
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;
22
23
use TechDivision\Import\Actions\Processors\ProcessorInterface;
24
25
/**
26
 * An abstract action implementation.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2016 TechDivision GmbH <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      https://github.com/techdivision/import
32
 * @link      http://www.techdivision.com
33
 */
34
abstract class AbstractAction implements ActionInterface
35
{
36
37
    /**
38
     * The create processor instance.
39
     *
40
     * @var \TechDivision\Import\Actions\Processors\ProcessorInterface
41
     */
42
    protected $createProcessor;
43
44
    /**
45
     * The delete processor instance.
46
     *
47
     * @var \TechDivision\Import\Actions\Processors\ProcessorInterface
48
     */
49
    protected $deleteProcessor;
50
51
    /**
52
     * The update processor instance.
53
     *
54
     * @var \TechDivision\Import\Actions\Processors\ProcessorInterface
55
     */
56
    protected $updateProcessor;
57
58
    /**
59
     * Set's the create processor instance.
60
     *
61
     * @param \TechDivision\Import\Actions\Processors\ProcessorInterface $createProcessor The create processor instance to use
62
     *
63
     * @return void
64
     */
65 1
    public function setCreateProcessor(ProcessorInterface $createProcessor)
66
    {
67 1
        $this->createProcessor = $createProcessor;
68 1
    }
69
70
    /**
71
     * Return's the create processor instance.
72
     *
73
     * @return \TechDivision\Import\Actions\Processors\ProcessorInterface The create processor instance
74
     */
75 1
    public function getCreateProcessor()
76
    {
77 1
        return $this->createProcessor;
78
    }
79
80
    /**
81
     * Set's the delete processor instance.
82
     *
83
     * @param \TechDivision\Import\Actions\Processors\ProcessorInterface $deleteProcessor The delete processor instance to use
84
     *
85
     * @return void
86
     */
87 1
    public function setDeleteProcessor(ProcessorInterface $deleteProcessor)
88
    {
89 1
        $this->deleteProcessor = $deleteProcessor;
90 1
    }
91
92
    /**
93
     * Return's the delete processor instance.
94
     *
95
     * @return \TechDivision\Import\Actions\Processors\ProcessorInterface The delete processor instance
96
     */
97 1
    public function getDeleteProcessor()
98
    {
99 1
        return $this->deleteProcessor;
100
    }
101
102
    /**
103
     * Set's the update processor instance.
104
     *
105
     * @param \TechDivision\Import\Actions\Processors\ProcessorInterface $updateProcessor The update processor instance to use
106
     *
107
     * @return void
108
     */
109
    public function setUpdateProcessor(ProcessorInterface $updateProcessor)
110
    {
111
        $this->updateProcessor = $updateProcessor;
112
    }
113
114
    /**
115
     * Return's the update processor instance.
116
     *
117
     * @return \TechDivision\Import\Actions\Processors\ProcessorInterface The update processor instance
118
     */
119
    public function getUpdateProcessor()
120
    {
121
        return $this->updateProcessor;
122
    }
123
124
    /**
125
     * Creates's the entity with the passed attributes.
126
     *
127
     * @param array       $row  The attributes of the entity to create
128
     * @param string|null $name The name of the prepared statement that has to be executed
129
     *
130
     * @return void
131
     */
132 1
    public function create($row, $name = null)
133
    {
134 1
        $this->getCreateProcessor()->execute($row, $name);
135 1
    }
136
137
    /**
138
     * Delete's the entity with the passed attributes.
139
     *
140
     * @param array       $row  The attributes of the entity to delete
141
     * @param string|null $name The name of the prepared statement that has to be executed
142
     *
143
     * @return void
144
     */
145 1
    public function delete($row, $name = null)
146
    {
147 1
        $this->getDeleteProcessor()->execute($row, $name);
148 1
    }
149
150
    /**
151
     * Update's the entity with the passed attributes.
152
     *
153
     * @param array       $row  The attributes of the entity to update
154
     * @param string|null $name The name of the prepared statement that has to be executed
155
     *
156
     * @return void
157
     */
158
    public function update($row, $name = null)
159
    {
160
        $this->getUpdateProcessor()->execute($row, $name);
161
    }
162
}
163