1 | <?php |
||
37 | class Subject implements SubjectInterface |
||
38 | { |
||
39 | |||
40 | /** |
||
41 | * The subject's delimiter character for CSV files. |
||
42 | * |
||
43 | * @var string |
||
44 | * @Type("string") |
||
45 | */ |
||
46 | protected $delimiter; |
||
47 | |||
48 | /** |
||
49 | * The subject's enclosure character for CSV files. |
||
50 | * |
||
51 | * @var string |
||
52 | * @Type("string") |
||
53 | */ |
||
54 | protected $enclosure; |
||
55 | |||
56 | /** |
||
57 | * The subject's escape character for CSV files. |
||
58 | * |
||
59 | * @var string |
||
60 | * @Type("string") |
||
61 | */ |
||
62 | protected $escape; |
||
63 | |||
64 | /** |
||
65 | * The subject's source charset for the CSV file. |
||
66 | * |
||
67 | * @var string |
||
68 | * @Type("string") |
||
69 | * @SerializedName("from-charset") |
||
70 | */ |
||
71 | protected $fromCharset; |
||
72 | |||
73 | /** |
||
74 | * The subject's target charset for a CSV file. |
||
75 | * |
||
76 | * @var string |
||
77 | * @Type("string") |
||
78 | * @SerializedName("to-charset") |
||
79 | */ |
||
80 | protected $toCharset; |
||
81 | |||
82 | /** |
||
83 | * The subject's file mode for a CSV target file. |
||
84 | * |
||
85 | * @var string |
||
86 | * @Type("string") |
||
87 | * @SerializedName("file-mode") |
||
88 | */ |
||
89 | protected $fileMode; |
||
90 | |||
91 | /** |
||
92 | * The flag to signal that the subject has to use the strict mode or not. |
||
93 | * |
||
94 | * @var boolean |
||
95 | * @Type("boolean") |
||
96 | * @SerializedName("strict-mode") |
||
97 | */ |
||
98 | protected $strictMode; |
||
99 | |||
100 | /** |
||
101 | * The subject's class name. |
||
102 | * |
||
103 | * @var string |
||
104 | * @Type("string") |
||
105 | * @SerializedName("class-name") |
||
106 | */ |
||
107 | protected $className; |
||
108 | |||
109 | /** |
||
110 | * The subject's processor type to use. |
||
111 | * |
||
112 | * @var string |
||
113 | * @Type("string") |
||
114 | * @SerializedName("processor-factory") |
||
115 | */ |
||
116 | protected $processorFactory; |
||
117 | |||
118 | /** |
||
119 | * The subject's utility class with the SQL statements to use. |
||
120 | * |
||
121 | * @var string |
||
122 | * @Type("string") |
||
123 | * @SerializedName("utility-class-name") |
||
124 | */ |
||
125 | protected $utilityClassName; |
||
126 | |||
127 | /** |
||
128 | * The file prefix for import files. |
||
129 | * |
||
130 | * @var string |
||
131 | * @Type("string") |
||
132 | */ |
||
133 | protected $prefix = 'magento-import'; |
||
134 | |||
135 | /** |
||
136 | * The source date format to use in the subject. |
||
137 | * |
||
138 | * @var string |
||
139 | * @Type("string") |
||
140 | * @SerializedName("source-date-format") |
||
141 | */ |
||
142 | protected $sourceDateFormat = 'n/d/y, g:i A'; |
||
143 | |||
144 | /** |
||
145 | * The source directory that has to be watched for new files. |
||
146 | * |
||
147 | * @var string |
||
148 | * @Type("string") |
||
149 | * @SerializedName("source-dir") |
||
150 | */ |
||
151 | protected $sourceDir; |
||
152 | |||
153 | /** |
||
154 | * The target directory with the files to be imported. |
||
155 | * |
||
156 | * @var string |
||
157 | * @Type("string") |
||
158 | * @SerializedName("target-dir") |
||
159 | */ |
||
160 | protected $targetDir; |
||
161 | |||
162 | /** |
||
163 | * The array with the subject's observers. |
||
164 | * |
||
165 | * @var array |
||
166 | * @Type("array") |
||
167 | */ |
||
168 | protected $observers = array(); |
||
169 | |||
170 | /** |
||
171 | * The array with the subject's callbacks. |
||
172 | * |
||
173 | * @var array |
||
174 | * @Type("array<string, array>") |
||
175 | */ |
||
176 | protected $callbacks = array(); |
||
177 | |||
178 | /** |
||
179 | * The array with the subject's params. |
||
180 | * |
||
181 | * @var array |
||
182 | * @Type("array") |
||
183 | */ |
||
184 | protected $params = array(); |
||
185 | |||
186 | /** |
||
187 | * A reference to the parent configuration instance. |
||
188 | * |
||
189 | * @var \TechDivision\Import\ConfigurationInterface |
||
190 | */ |
||
191 | protected $configuration; |
||
192 | |||
193 | /** |
||
194 | * Return's the delimiter character to use, default value is comma (,). |
||
195 | * |
||
196 | * @return string The delimiter character |
||
197 | */ |
||
198 | public function getDelimiter() |
||
202 | |||
203 | /** |
||
204 | * The enclosure character to use, default value is double quotation ("). |
||
205 | * |
||
206 | * @return string The enclosure character |
||
207 | */ |
||
208 | public function getEnclosure() |
||
212 | |||
213 | /** |
||
214 | * The escape character to use, default value is backslash (\). |
||
215 | * |
||
216 | * @return string The escape character |
||
217 | */ |
||
218 | public function getEscape() |
||
222 | |||
223 | /** |
||
224 | * The file encoding of the CSV source file, default value is UTF-8. |
||
225 | * |
||
226 | * @return string The charset used by the CSV source file |
||
227 | */ |
||
228 | public function getFromCharset() |
||
232 | |||
233 | /** |
||
234 | * The file encoding of the CSV targetfile, default value is UTF-8. |
||
235 | * |
||
236 | * @return string The charset used by the CSV target file |
||
237 | */ |
||
238 | public function getToCharset() |
||
242 | |||
243 | /** |
||
244 | * The file mode of the CSV target file, either one of write or append, default is write. |
||
245 | * |
||
246 | * @return string The file mode of the CSV target file |
||
247 | */ |
||
248 | public function getFileMode() |
||
252 | |||
253 | /** |
||
254 | * Queries whether or not strict mode is enabled or not, default is TRUE. |
||
255 | * |
||
256 | * @return boolean TRUE if strict mode is enabled, else FALSE |
||
257 | */ |
||
258 | public function isStrictMode() |
||
262 | |||
263 | /** |
||
264 | * Return's the subject's class name. |
||
265 | * |
||
266 | * @return string The subject's class name |
||
267 | */ |
||
268 | public function getClassName() |
||
272 | |||
273 | /** |
||
274 | * Return's the subject's processor factory type to use. |
||
275 | * |
||
276 | * @return string The subject's processor factory type |
||
277 | */ |
||
278 | public function getProcessorFactory() |
||
282 | |||
283 | /** |
||
284 | * Return's the utility class with the SQL statements to use. |
||
285 | * |
||
286 | * @return string The utility class name |
||
287 | */ |
||
288 | public function getUtilityClassName() |
||
292 | |||
293 | /** |
||
294 | * Return's the array with the params. |
||
295 | * |
||
296 | * @return array The params |
||
297 | */ |
||
298 | public function getParams() |
||
305 | |||
306 | /** |
||
307 | * Query whether or not the param with the passed name exists. |
||
308 | * |
||
309 | * @param string $name The name of the param to be queried |
||
310 | * |
||
311 | * @return boolean TRUE if the requested param exists, else FALSE |
||
312 | */ |
||
313 | public function hasParam($name) |
||
317 | |||
318 | /** |
||
319 | * Return's the param with the passed name. |
||
320 | * |
||
321 | * @param string $name The name of the param to return |
||
322 | * @param mixed $defaultValue The default value if the param doesn't exists |
||
323 | * |
||
324 | * @return string The requested param |
||
325 | * @throws \Exception Is thrown, if the requested param is not available |
||
326 | */ |
||
327 | public function getParam($name, $defaultValue = null) |
||
343 | |||
344 | /** |
||
345 | * Set's the reference to the configuration instance. |
||
346 | * |
||
347 | * @param \TechDivision\Import\ConfigurationInterface $configuration The configuration instance |
||
348 | * |
||
349 | * @return void |
||
350 | */ |
||
351 | public function setConfiguration(ConfigurationInterface $configuration) |
||
355 | |||
356 | /** |
||
357 | * Return's the reference to the configuration instance. |
||
358 | * |
||
359 | * @return \TechDivision\Import\ConfigurationInterface The configuration instance |
||
360 | */ |
||
361 | public function getConfiguration() |
||
365 | |||
366 | /** |
||
367 | * Set's the prefix for the import files. |
||
368 | * |
||
369 | * @param string $prefix The prefix |
||
370 | * |
||
371 | * @return void |
||
372 | */ |
||
373 | public function setPrefix($prefix) |
||
377 | |||
378 | /** |
||
379 | * Return's the prefix for the import files. |
||
380 | * |
||
381 | * @return string The prefix |
||
382 | */ |
||
383 | public function getPrefix() |
||
387 | |||
388 | /** |
||
389 | * Return's the array with the subject's observers. |
||
390 | * |
||
391 | * @return array The subject's observers |
||
392 | */ |
||
393 | public function getObservers() |
||
397 | |||
398 | /** |
||
399 | * Return's the array with the subject's callbacks. |
||
400 | * |
||
401 | * @return array The subject's callbacks |
||
402 | */ |
||
403 | public function getCallbacks() |
||
407 | |||
408 | /** |
||
409 | * Return's the subject's source date format to use. |
||
410 | * |
||
411 | * @return string The source date format |
||
412 | */ |
||
413 | public function getSourceDateFormat() |
||
417 | |||
418 | /** |
||
419 | * Set's the subject's source date format to use. |
||
420 | * |
||
421 | * @param string $sourceDateFormat The source date format |
||
422 | * |
||
423 | * @return void |
||
424 | */ |
||
425 | public function setSourceDateFormat($sourceDateFormat) |
||
429 | |||
430 | /** |
||
431 | * Set's the source directory that has to be watched for new files. |
||
432 | * |
||
433 | * @param string $sourceDir The source directory |
||
434 | * |
||
435 | * @return void |
||
436 | */ |
||
437 | public function setSourceDir($sourceDir) |
||
441 | |||
442 | /** |
||
443 | * Return's the source directory that has to be watched for new files. |
||
444 | * |
||
445 | * @return string The source directory |
||
446 | */ |
||
447 | public function getSourceDir() |
||
451 | |||
452 | /** |
||
453 | * Return's the target directory with the files to be imported. |
||
454 | * |
||
455 | * @return string The target directory |
||
456 | */ |
||
457 | public function getTargetDir() |
||
461 | |||
462 | /** |
||
463 | * Set's the target directory with the files to be imported. |
||
464 | * |
||
465 | * @param string $targetDir The target directory |
||
466 | * |
||
467 | * @return void |
||
468 | */ |
||
469 | public function setTargetDir($targetDir) |
||
473 | } |
||
474 |