1 | <?php |
||
42 | class UrlKeyAndPathObserver extends AbstractCategoryImportObserver |
||
43 | { |
||
44 | |||
45 | /** |
||
46 | * The trait that provides string => URL key conversion functionality. |
||
47 | * |
||
48 | * @var \TechDivision\Import\Utils\Filter\UrlKeyFilterTrait |
||
49 | */ |
||
50 | use UrlKeyFilterTrait; |
||
51 | |||
52 | /** |
||
53 | * The URL key utility instance. |
||
54 | * |
||
55 | * @var \TechDivision\Import\Utils\UrlKeyUtilInterface |
||
56 | */ |
||
57 | protected $urlKeyUtil; |
||
58 | |||
59 | /** |
||
60 | * The category bunch processor instance. |
||
61 | * |
||
62 | * @var \TechDivision\Import\Category\Services\CategoryBunchProcessorInterface |
||
63 | */ |
||
64 | protected $categoryBunchProcessor; |
||
65 | |||
66 | /** |
||
67 | * Initialize the observer with the passed product bunch processor instance. |
||
68 | * |
||
69 | * @param \TechDivision\Import\Category\Services\CategoryBunchProcessorInterface $categoryBunchProcessor The category bunch processor instance |
||
70 | * @param \Zend\Filter\FilterInterface $convertLiteralUrlFilter The URL filter instance |
||
71 | * @param \TechDivision\Import\Utils\UrlKeyUtilInterface $urlKeyUtil The URL key utility instance |
||
72 | */ |
||
73 | public function __construct( |
||
84 | |||
85 | /** |
||
86 | * Process the observer's business logic. |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | protected function process() |
||
150 | |||
151 | /** |
||
152 | * Return the primary key member name. |
||
153 | * |
||
154 | * @return string The primary key member name |
||
155 | */ |
||
156 | protected function getPkMemberName() |
||
160 | |||
161 | /** |
||
162 | * Returns the category bunch processor instance. |
||
163 | * |
||
164 | * @return \TechDivision\Import\Category\Services\CategoryBunchProcessorInterface The category bunch processor instance |
||
165 | */ |
||
166 | protected function getCategoryBunchProcessor() |
||
170 | |||
171 | /** |
||
172 | * Returns the URL key utility instance. |
||
173 | * |
||
174 | * @return \TechDivision\Import\Utils\UrlKeyUtilInterface The URL key utility instance |
||
175 | */ |
||
176 | protected function getUrlKeyUtil() |
||
180 | |||
181 | /** |
||
182 | * Return's the category with the passed path. |
||
183 | * |
||
184 | * @param string $path The path of the category to return |
||
185 | * |
||
186 | * @return array The category |
||
187 | * @throws \Exception Is thrown, if the requested category is not available |
||
188 | */ |
||
189 | protected function getCategoryByPath($path) |
||
193 | |||
194 | /** |
||
195 | * Returns the category with the passed primary key and the attribute values for the passed store ID. |
||
196 | * |
||
197 | * @param string $pk The primary key of the category to return |
||
198 | * @param integer $storeId The store ID of the category values |
||
199 | * |
||
200 | * @return array|null The category data |
||
201 | */ |
||
202 | protected function getCategoryByPkAndStoreId($pk, $storeId) |
||
206 | |||
207 | /** |
||
208 | * Temporarily persist's the IDs of the passed category. |
||
209 | * |
||
210 | * @param array $category The category to temporarily persist the IDs for |
||
211 | * |
||
212 | * @return void |
||
213 | */ |
||
214 | protected function setIds(array $category) |
||
218 | |||
219 | /** |
||
220 | * Set's the ID of the category that has been created recently. |
||
221 | * |
||
222 | * @param string $lastEntityId The entity ID |
||
223 | * |
||
224 | * @return void |
||
225 | */ |
||
226 | protected function setLastEntityId($lastEntityId) |
||
230 | |||
231 | /** |
||
232 | * Make's the passed URL key unique by adding the next number to the end. |
||
233 | * |
||
234 | * @param string $urlKey The URL key to make unique |
||
235 | * |
||
236 | * @return string The unique URL key |
||
237 | */ |
||
238 | protected function makeUnique(UrlKeyAwareSubjectInterface $subject, $urlKey) |
||
242 | } |
||
243 |
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.