1 | <?php |
||
36 | class ProductObserver extends AbstractProductImportObserver |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * Will be invoked by the action on the events the listener has been registered for. |
||
41 | * |
||
42 | * @param array $row The row to handle |
||
43 | * |
||
44 | * @return array The modified row |
||
45 | * @see \TechDivision\Import\Product\Observers\ImportObserverInterface::handle() |
||
46 | */ |
||
47 | 1 | public function handle(array $row) |
|
59 | |||
60 | /** |
||
61 | * Process the observer's business logic. |
||
62 | * |
||
63 | * @return array The processed row |
||
64 | */ |
||
65 | 1 | protected function process() |
|
79 | |||
80 | /** |
||
81 | * Prepare the attributes of the entity that has to be persisted. |
||
82 | * |
||
83 | * @return array The prepared attributes |
||
84 | */ |
||
85 | 1 | protected function prepareAttributes() |
|
118 | |||
119 | /** |
||
120 | * Initialize the product with the passed attributes and returns an instance. |
||
121 | * |
||
122 | * @param array $attr The product attributes |
||
123 | * |
||
124 | * @return array The initialized product |
||
125 | */ |
||
126 | protected function initializeProduct(array $attr) |
||
130 | |||
131 | /** |
||
132 | * Persist's the passed product data and return's the ID. |
||
133 | * |
||
134 | * @param array $product The product data to persist |
||
135 | * |
||
136 | * @return string The ID of the persisted entity |
||
137 | */ |
||
138 | 1 | protected function persistProduct($product) |
|
142 | |||
143 | /** |
||
144 | * Set's the attribute set of the product that has to be created. |
||
145 | * |
||
146 | * @param array $attributeSet The attribute set |
||
147 | * |
||
148 | * @return void |
||
149 | */ |
||
150 | 1 | protected function setAttributeSet(array $attributeSet) |
|
154 | |||
155 | /** |
||
156 | * Return's the attribute set of the product that has to be created. |
||
157 | * |
||
158 | * @return array The attribute set |
||
159 | */ |
||
160 | protected function getAttributeSet() |
||
164 | |||
165 | /** |
||
166 | * Return's the attribute set with the passed attribute set name. |
||
167 | * |
||
168 | * @param string $attributeSetName The name of the requested attribute set |
||
169 | * |
||
170 | * @return array The attribute set data |
||
171 | */ |
||
172 | 1 | protected function getAttributeSetByAttributeSetName($attributeSetName) |
|
176 | |||
177 | /** |
||
178 | * Set's the ID of the product that has been created recently. |
||
179 | * |
||
180 | * @param string $lastEntityId The entity ID |
||
181 | * |
||
182 | * @return void |
||
183 | */ |
||
184 | 1 | protected function setLastEntityId($lastEntityId) |
|
188 | } |
||
189 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.