Completed
Push — master ( f00f69...c631b8 )
by Tim
9s
created

Configuration   F

Complexity

Total Complexity 69

Size/Duplication

Total Lines 983
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 3

Importance

Changes 0
Metric Value
wmc 69
lcom 5
cbo 3
dl 0
loc 983
rs 2.2641
c 0
b 0
f 0

55 Methods

Rating   Name   Duplication   Size   Complexity  
A getPlugins() 0 14 3
A mapBoolean() 0 11 2
A getOperation() 0 4 1
A getId() 0 4 1
A setOperationName() 0 4 1
A getOperationName() 0 4 1
A setInstallationDir() 0 4 1
A getInstallationDir() 0 4 1
A setSourceDir() 0 4 1
A getSourceDir() 0 4 1
A setTargetDir() 0 4 1
A getTargetDir() 0 4 1
A setMagentoEdition() 0 4 1
A getMagentoEdition() 0 4 1
A setMagentoVersion() 0 4 1
A getMagentoVersion() 0 4 1
A getSourceDateFormat() 0 4 1
A setSourceDateFormat() 0 4 1
A getEntityTypeCode() 0 4 1
A setEntityTypeCode() 0 4 1
A getMultipleFieldDelimiter() 0 4 1
A getMultipleValueDelimiter() 0 4 1
A getDelimiter() 0 4 1
A getEnclosure() 0 4 1
A getEscape() 0 4 1
A getFromCharset() 0 4 1
A getToCharset() 0 4 1
A getFileMode() 0 4 1
A isStrictMode() 0 4 1
A clearDatabases() 0 4 1
A addDatabase() 0 4 1
A countDatabases() 0 4 1
C getDatabase() 0 33 7
A getOperations() 0 4 1
A getLoggers() 0 4 1
A setArchiveArtefacts() 0 4 1
A haveArchiveArtefacts() 0 4 1
A setArchiveDir() 0 4 1
A getArchiveDir() 0 4 1
A setDebugMode() 0 4 1
A isDebugMode() 0 4 1
A setLogLevel() 0 4 1
A getLogLevel() 0 4 1
A setUseDbId() 0 4 1
A getUseDbId() 0 4 1
A setPidFilename() 0 4 1
A getPidFilename() 0 4 1
A setSystemName() 0 4 1
A getSystemName() 0 4 1
A setExtensionLibraries() 0 4 1
A getExtensionLibraries() 0 4 1
A getAdditionalVendorDirs() 0 4 1
A postDeserialize() 0 18 4
A getHeaderMappings() 0 14 2
A getImageTypes() 0 14 2

How to fix   Complexity   

Complex Class

Complex classes like Configuration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Configuration, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/**
4
 * TechDivision\Import\Configuration\Jms\Configuration
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-configuration-jms
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Configuration\Jms;
22
23
use Psr\Log\LogLevel;
24
use JMS\Serializer\Annotation\Type;
25
use JMS\Serializer\Annotation\Exclude;
26
use JMS\Serializer\Annotation\SerializedName;
27
use JMS\Serializer\Annotation\PostDeserialize;
28
use JMS\Serializer\Annotation\ExclusionPolicy;
29
use Doctrine\Common\Collections\ArrayCollection;
30
use TechDivision\Import\ConfigurationInterface;
31
use TechDivision\Import\Configuration\DatabaseConfigurationInterface;
32
use TechDivision\Import\Configuration\Jms\Configuration\Operation;
33
34
/**
35
 * A simple JMS based configuration implementation.
36
 *
37
 * @author    Tim Wagner <[email protected]>
38
 * @copyright 2016 TechDivision GmbH <[email protected]>
39
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
40
 * @link      https://github.com/techdivision/import-configuration-jms
41
 * @link      http://www.techdivision.com
42
 *
43
 * @ExclusionPolicy("none")
44
 */
45
class Configuration implements ConfigurationInterface
46
{
47
48
    /**
49
     * The default PID filename to use.
50
     *
51
     * @var string
52
     */
53
    const PID_FILENAME = 'importer.pid';
54
55
    /**
56
     * Mapping for boolean values passed on the console.
57
     *
58
     * @var array
59
     * @Exclude
60
     */
61
    protected $booleanMapping = array(
62
        'true'  => true,
63
        'false' => false,
64
        '1'     => true,
65
        '0'     => false,
66
        'on'    => true,
67
        'off'   => false
68
    );
69
70
    /**
71
     * The application's unique DI identifier.
72
     *
73
     * @var string
74
     * @Type("string")
75
     * @SerializedName("id")
76
     */
77
    protected $id;
78
79
    /**
80
     * The system name to use.
81
     *
82
     * @var string
83
     * @Type("string")
84
     * @SerializedName("system-name")
85
     */
86
    protected $systemName;
87
88
    /**
89
     * The operation name to use.
90
     *
91
     * @var string
92
     * @Type("string")
93
     * @SerializedName("operation-name")
94
     */
95
    protected $operationName;
96
97
    /**
98
     * The entity type code to use.
99
     *
100
     * @var string
101
     * @Type("string")
102
     * @SerializedName("entity-type-code")
103
     */
104
    protected $entityTypeCode;
105
106
    /**
107
     * The Magento installation directory.
108
     *
109
     * @var string
110
     * @Type("string")
111
     * @SerializedName("installation-dir")
112
     */
113
    protected $installationDir;
114
115
    /**
116
     * The source directory that has to be watched for new files.
117
     *
118
     * @var string
119
     * @Type("string")
120
     * @SerializedName("source-dir")
121
     */
122
    protected $sourceDir;
123
124
    /**
125
     * The target directory with the files that has been imported.
126
     *
127
     * @var string
128
     * @Type("string")
129
     * @SerializedName("target-dir")
130
     */
131
    protected $targetDir;
132
133
    /**
134
     * The Magento edition, EE or CE.
135
     *
136
     * @var string
137
     * @Type("string")
138
     * @SerializedName("magento-edition")
139
     */
140
    protected $magentoEdition = 'CE';
141
142
    /**
143
     * The Magento version, e. g. 2.1.0.
144
     *
145
     * @var string
146
     * @Type("string")
147
     * @SerializedName("magento-version")
148
     */
149
    protected $magentoVersion = '2.1.2';
150
151
    /**
152
     * ArrayCollection with the information of the configured databases.
153
     *
154
     * @var \Doctrine\Common\Collections\ArrayCollection
155
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Database>")
156
     */
157
    protected $databases;
158
159
    /**
160
     * ArrayCollection with the information of the configured loggers.
161
     *
162
     * @var \Doctrine\Common\Collections\ArrayCollection
163
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Logger>")
164
     */
165
    protected $loggers;
166
167
    /**
168
     * ArrayCollection with the information of the configured operations.
169
     *
170
     * @var \Doctrine\Common\Collections\ArrayCollection
171
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Operation>")
172
     */
173
    protected $operations;
174
175
    /**
176
     * The source date format to use in the subject.
177
     *
178
     * @var string
179
     * @Type("string")
180
     * @SerializedName("source-date-format")
181
     */
182
    protected $sourceDateFormat = 'n/d/y, g:i A';
183
184
    /**
185
     * The subject's multiple field delimiter character for fields with multiple values, defaults to (,).
186
     *
187
     * @var string
188
     * @Type("string")
189
     * @SerializedName("multiple-field-delimiter")
190
     */
191
    protected $multipleFieldDelimiter = ',';
192
193
    /**
194
     * The subject's multiple value delimiter character for fields with multiple values, defaults to (|).
195
     *
196
     * @var string
197
     * @Type("string")
198
     * @SerializedName("multiple-value-delimiter")
199
     */
200
    protected $multipleValueDelimiter = '|';
201
202
    /**
203
     * The subject's delimiter character for CSV files.
204
     *
205
     * @var string
206
     * @Type("string")
207
     */
208
    protected $delimiter;
209
210
    /**
211
     * The subject's enclosure character for CSV files.
212
     *
213
     * @var string
214
     * @Type("string")
215
     */
216
    protected $enclosure;
217
218
    /**
219
     * The subject's escape character for CSV files.
220
     *
221
     * @var string
222
     * @Type("string")
223
     */
224
    protected $escape;
225
226
    /**
227
     * The subject's source charset for the CSV file.
228
     *
229
     * @var string
230
     * @Type("string")
231
     * @SerializedName("from-charset")
232
     */
233
    protected $fromCharset;
234
235
    /**
236
     * The subject's target charset for a CSV file.
237
     *
238
     * @var string
239
     * @Type("string")
240
     * @SerializedName("to-charset")
241
     */
242
    protected $toCharset;
243
244
    /**
245
     * The subject's file mode for a CSV target file.
246
     *
247
     * @var string
248
     * @Type("string")
249
     * @SerializedName("file-mode")
250
     */
251
    protected $fileMode;
252
253
    /**
254
     * The flag to signal that the subject has to use the strict mode or not.
255
     *
256
     * @var boolean
257
     * @Type("boolean")
258
     * @SerializedName("strict-mode")
259
     */
260
    protected $strictMode;
261
262
    /**
263
     * The flag whether or not the import artefacts have to be archived.
264
     *
265
     * @var boolean
266
     * @Type("boolean")
267
     * @SerializedName("archive-artefacts")
268
     */
269
    protected $archiveArtefacts;
270
271
    /**
272
     * The directory where the archives will be stored.
273
     *
274
     * @var string
275
     * @Type("string")
276
     * @SerializedName("archive-dir")
277
     */
278
    protected $archiveDir;
279
280
    /**
281
     * The flag to signal that the subject has to use the debug mode or not.
282
     *
283
     * @var boolean
284
     * @Type("boolean")
285
     * @SerializedName("debug-mode")
286
     */
287
    protected $debugMode = false;
288
289
    /**
290
     * The log level to use (see Monolog documentation).
291
     *
292
     * @var string
293
     * @Type("string")
294
     * @SerializedName("log-level")
295
     */
296
    protected $logLevel = LogLevel::INFO;
297
298
    /**
299
     * The explicit DB ID to use.
300
     *
301
     * @var string
302
     * @Type("string")
303
     * @SerializedName("use-db-id")
304
     */
305
    protected $useDbId;
306
307
    /**
308
     * The explicit PID filename to use.
309
     *
310
     * @var string
311
     * @Type("string")
312
     * @SerializedName("pid-filename")
313
     */
314
    protected $pidFilename;
315
316
    /**
317
     * The collection with the paths to additional vendor directories.
318
     *
319
     * @var \Doctrine\Common\Collections\ArrayCollection
320
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\VendorDir>")
321
     * @SerializedName("additional-vendor-dirs")
322
     */
323
    protected $additionalVendorDirs;
324
325
    /**
326
     * The array with the Magento Edition specific extension libraries.
327
     *
328
     * @var array
329
     * @Type("array")
330
     * @SerializedName("extension-libraries")
331
     */
332
    protected $extensionLibraries = array();
333
334
    /**
335
     * The array with the custom header mappings.
336
     *
337
     * @var array
338
     * @Type("array")
339
     * @SerializedName("header-mappings")
340
     */
341
    protected $headerMappings = array();
342
343
    /**
344
     * The array with the custom image types.
345
     *
346
     * @var array
347
     * @Type("array")
348
     * @SerializedName("image-types")
349
     */
350
    protected $imageTypes = array();
351
352
    /**
353
     * Return's the array with the plugins of the operation to use.
354
     *
355
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the plugins
356
     * @throws \Exception Is thrown, if no plugins are available for the actual operation
357
     */
358
    public function getPlugins()
359
    {
360
361
        // iterate over the operations and return the subjects of the actual one
362
        /** @var TechDivision\Import\Configuration\OperationInterface $operation */
363
        foreach ($this->getOperations() as $operation) {
364
            if ($this->getOperation()->equals($operation)) {
365
                return $operation->getPlugins();
366
            }
367
        }
368
369
        // throw an exception if no plugins are available
370
        throw new \Exception(sprintf('Can\'t find any plugins for operation %s', $this->getOperation()));
371
    }
372
373
    /**
374
     * Map's the passed value to a boolean.
375
     *
376
     * @param string $value The value to map
377
     *
378
     * @return boolean The mapped value
379
     * @throws \Exception Is thrown, if the value can't be mapped
380
     */
381
    public function mapBoolean($value)
382
    {
383
384
        // try to map the passed value to a boolean
385
        if (isset($this->booleanMapping[$value])) {
386
            return $this->booleanMapping[$value];
387
        }
388
389
        // throw an exception if we can't convert the passed value
390
        throw new \Exception(sprintf('Can\'t convert %s to boolean', $value));
391
    }
392
393
    /**
394
     * Return's the operation, initialize from the actual operation name.
395
     *
396
     * @return \TechDivision\Import\Configuration\OperationConfigurationInterface The operation instance
397
     */
398
    protected function getOperation()
399
    {
400
        return new Operation($this->getOperationName());
401
    }
402
403
    /**
404
     * Return's the application's unique DI identifier.
405
     *
406
     * @return string The application's unique DI identifier
407
     */
408
    public function getId()
409
    {
410
        return $this->id;
411
    }
412
413
    /**
414
     * Return's the operation name that has to be used.
415
     *
416
     * @param string $operationName The operation name that has to be used
417
     *
418
     * @return void
419
     */
420
    public function setOperationName($operationName)
421
    {
422
        return $this->operationName = $operationName;
423
    }
424
425
    /**
426
     * Return's the operation name that has to be used.
427
     *
428
     * @return string The operation name that has to be used
429
     */
430
    public function getOperationName()
431
    {
432
        return $this->operationName;
433
    }
434
435
    /**
436
     * Set's the Magento installation directory.
437
     *
438
     * @param string $installationDir The Magento installation directory
439
     *
440
     * @return void
441
     */
442
    public function setInstallationDir($installationDir)
443
    {
444
        $this->installationDir = $installationDir;
445
    }
446
447
    /**
448
     * Return's the Magento installation directory.
449
     *
450
     * @return string The Magento installation directory
451
     */
452
    public function getInstallationDir()
453
    {
454
        return $this->installationDir;
455
    }
456
457
    /**
458
     * Set's the source directory that has to be watched for new files.
459
     *
460
     * @param string $sourceDir The source directory
461
     *
462
     * @return void
463
     */
464
    public function setSourceDir($sourceDir)
465
    {
466
        $this->sourceDir = $sourceDir;
467
    }
468
469
    /**
470
     * Return's the source directory that has to be watched for new files.
471
     *
472
     * @return string The source directory
473
     */
474
    public function getSourceDir()
475
    {
476
        return $this->sourceDir;
477
    }
478
479
    /**
480
     * Set's the target directory with the files that has been imported.
481
     *
482
     * @param string $targetDir The target directory
483
     *
484
     * @return void
485
     */
486
    public function setTargetDir($targetDir)
487
    {
488
        $this->targetDir = $targetDir;
489
    }
490
491
    /**
492
     * Return's the target directory with the files that has been imported.
493
     *
494
     * @return string The target directory
495
     */
496
    public function getTargetDir()
497
    {
498
        return $this->targetDir;
499
    }
500
501
    /**
502
     * Set's the Magento edition, EE or CE.
503
     *
504
     * @param string $magentoEdition The Magento edition
505
     *
506
     * @return void
507
     */
508
    public function setMagentoEdition($magentoEdition)
509
    {
510
        $this->magentoEdition = $magentoEdition;
511
    }
512
513
    /**
514
     * Return's the Magento edition, EE or CE.
515
     *
516
     * @return string The Magento edition
517
     */
518
    public function getMagentoEdition()
519
    {
520
        return $this->magentoEdition;
521
    }
522
523
    /**
524
     * Return's the Magento version, e. g. 2.1.0.
525
     *
526
     * @param string $magentoVersion The Magento version
527
     *
528
     * @return void
529
     */
530
    public function setMagentoVersion($magentoVersion)
531
    {
532
        $this->magentoVersion = $magentoVersion;
533
    }
534
535
    /**
536
     * Return's the Magento version, e. g. 2.1.0.
537
     *
538
     * @return string The Magento version
539
     */
540
    public function getMagentoVersion()
541
    {
542
        return $this->magentoVersion;
543
    }
544
545
    /**
546
     * Return's the subject's source date format to use.
547
     *
548
     * @return string The source date format
549
     */
550
    public function getSourceDateFormat()
551
    {
552
        return $this->sourceDateFormat;
553
    }
554
555
    /**
556
     * Set's the subject's source date format to use.
557
     *
558
     * @param string $sourceDateFormat The source date format
559
     *
560
     * @return void
561
     */
562
    public function setSourceDateFormat($sourceDateFormat)
563
    {
564
        $this->sourceDateFormat = $sourceDateFormat;
565
    }
566
567
    /**
568
     * Return's the entity type code to be used.
569
     *
570
     * @return string The entity type code to be used
571
     */
572
    public function getEntityTypeCode()
573
    {
574
        return $this->entityTypeCode;
575
    }
576
577
    /**
578
     * Set's the entity type code to be used.
579
     *
580
     * @param string $entityTypeCode The entity type code
581
     *
582
     * @return void
583
     */
584
    public function setEntityTypeCode($entityTypeCode)
585
    {
586
        $this->entityTypeCode = $entityTypeCode;
587
    }
588
589
    /**
590
     * Return's the multiple field delimiter character to use, default value is comma (,).
591
     *
592
     * @return string The multiple field delimiter character
593
     */
594
    public function getMultipleFieldDelimiter()
595
    {
596
        return $this->multipleFieldDelimiter;
597
    }
598
599
    /**
600
     * Return's the multiple value delimiter character to use, default value is comma (|).
601
     *
602
     * @return string The multiple value delimiter character
603
     */
604
    public function getMultipleValueDelimiter()
605
    {
606
        return $this->multipleValueDelimiter;
607
    }
608
609
    /**
610
     * Return's the delimiter character to use, default value is comma (,).
611
     *
612
     * @return string The delimiter character
613
     */
614
    public function getDelimiter()
615
    {
616
        return $this->delimiter;
617
    }
618
619
    /**
620
     * The enclosure character to use, default value is double quotation (").
621
     *
622
     * @return string The enclosure character
623
     */
624
    public function getEnclosure()
625
    {
626
        return $this->enclosure;
627
    }
628
629
    /**
630
     * The escape character to use, default value is backslash (\).
631
     *
632
     * @return string The escape character
633
     */
634
    public function getEscape()
635
    {
636
        return $this->escape;
637
    }
638
639
    /**
640
     * The file encoding of the CSV source file, default value is UTF-8.
641
     *
642
     * @return string The charset used by the CSV source file
643
     */
644
    public function getFromCharset()
645
    {
646
        return $this->fromCharset;
647
    }
648
649
    /**
650
     * The file encoding of the CSV targetfile, default value is UTF-8.
651
     *
652
     * @return string The charset used by the CSV target file
653
     */
654
    public function getToCharset()
655
    {
656
        return $this->toCharset;
657
    }
658
659
    /**
660
     * The file mode of the CSV target file, either one of write or append, default is write.
661
     *
662
     * @return string The file mode of the CSV target file
663
     */
664
    public function getFileMode()
665
    {
666
        return $this->fileMode;
667
    }
668
669
    /**
670
     * Queries whether or not strict mode is enabled or not, default is TRUE.
671
     *
672
     * @return boolean TRUE if strict mode is enabled, else FALSE
673
     */
674
    public function isStrictMode()
675
    {
676
        return $this->strictMode;
677
    }
678
679
    /**
680
     * Remove's all configured database configuration.
681
     *
682
     * @return void
683
     */
684
    public function clearDatabases()
685
    {
686
        $this->databases->clear();
687
    }
688
689
    /**
690
     * Add's the passed database configuration.
691
     *
692
     * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration
693
     *
694
     * @return void
695
     */
696
    public function addDatabase(DatabaseConfigurationInterface $database)
697
    {
698
        $this->databases->add($database);
699
    }
700
701
    /**
702
     * Return's the number database configurations.
703
     *
704
     * @return integer The number of database configurations
705
     */
706
    public function countDatabases()
707
    {
708
        return $this->databases->count();
709
    }
710
711
    /**
712
     * Return's the database configuration.
713
     *
714
     * If an explicit DB ID is specified, the method tries to return the database with this ID. If
715
     * the database configuration is NOT available, an execption is thrown.
716
     *
717
     * If no explicit DB ID is specified, the method tries to return the default database configuration,
718
     * if not available the first one.
719
     *
720
     * @return \TechDivision\Import\Configuration\Jms\Configuration\Database The database configuration
721
     * @throws \Exception Is thrown, if no database configuration is available
722
     */
723
    public function getDatabase()
724
    {
725
726
        // if a DB ID has been set, try to load the database
727
        if ($useDbId = $this->getUseDbId()) {
728
            // iterate over the configured databases and return the one with the passed ID
729
            /** @var TechDivision\Import\Configuration\DatabaseInterface  $database */
730
            foreach ($this->databases as $database) {
731
                if ($database->getId() === $useDbId) {
732
                    return $database;
733
                }
734
            }
735
736
            // throw an exception, if the database with the passed ID is NOT configured
737
            throw new \Exception(sprintf('Database with ID %s can not be found', $useDbId));
738
        }
739
740
        // iterate over the configured databases and try return the default database
741
        /** @var TechDivision\Import\Configuration\DatabaseInterface  $database */
742
        foreach ($this->databases as $database) {
743
            if ($database->isDefault()) {
744
                return $database;
745
            }
746
        }
747
748
        // try to return the first database configurtion
749
        if ($this->databases->count() > 0) {
750
            return $this->databases->first();
751
        }
752
753
        // throw an exception, if no database configuration is available
754
        throw new \Exception('There is no database configuration available');
755
    }
756
757
    /**
758
     * Return's the ArrayCollection with the configured operations.
759
     *
760
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the operations
761
     */
762
    public function getOperations()
763
    {
764
        return $this->operations;
765
    }
766
767
    /**
768
     * Return's the ArrayCollection with the configured loggers.
769
     *
770
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the loggers
771
     */
772
    public function getLoggers()
773
    {
774
        return $this->loggers;
775
    }
776
777
    /**
778
     * Set's the flag that import artefacts have to be archived or not.
779
     *
780
     * @param boolean $archiveArtefacts TRUE if artefacts have to be archived, else FALSE
781
     *
782
     * @return void
783
     */
784
    public function setArchiveArtefacts($archiveArtefacts)
785
    {
786
        $this->archiveArtefacts = $archiveArtefacts;
787
    }
788
789
    /**
790
     * Return's the TRUE if the import artefacts have to be archived.
791
     *
792
     * @return boolean TRUE if the import artefacts have to be archived
793
     */
794
    public function haveArchiveArtefacts()
795
    {
796
        return $this->archiveArtefacts;
797
    }
798
799
    /**
800
     * The directory where the archives will be stored.
801
     *
802
     * @param string $archiveDir The archive directory
803
     *
804
     * @return void
805
     */
806
    public function setArchiveDir($archiveDir)
807
    {
808
        $this->archiveDir = $archiveDir;
809
    }
810
811
    /**
812
     * The directory where the archives will be stored.
813
     *
814
     * @return string The archive directory
815
     */
816
    public function getArchiveDir()
817
    {
818
        return $this->archiveDir;
819
    }
820
821
    /**
822
     * Set's the debug mode.
823
     *
824
     * @param boolean $debugMode TRUE if debug mode is enabled, else FALSE
825
     *
826
     * @return void
827
     */
828
    public function setDebugMode($debugMode)
829
    {
830
        $this->debugMode = $debugMode;
831
    }
832
833
    /**
834
     * Queries whether or not debug mode is enabled or not, default is TRUE.
835
     *
836
     * @return boolean TRUE if debug mode is enabled, else FALSE
837
     */
838
    public function isDebugMode()
839
    {
840
        return $this->debugMode;
841
    }
842
843
    /**
844
     * Set's the log level to use.
845
     *
846
     * @param string $logLevel The log level to use
847
     *
848
     * @return void
849
     */
850
    public function setLogLevel($logLevel)
851
    {
852
        $this->logLevel = $logLevel;
853
    }
854
855
    /**
856
     * Return's the log level to use.
857
     *
858
     * @return string The log level to use
859
     */
860
    public function getLogLevel()
861
    {
862
        return $this->logLevel;
863
    }
864
865
    /**
866
     * Set's the explicit DB ID to use.
867
     *
868
     * @param string $useDbId The explicit DB ID to use
869
     *
870
     * @return void
871
     */
872
    public function setUseDbId($useDbId)
873
    {
874
        $this->useDbId = $useDbId;
875
    }
876
877
    /**
878
     * Return's the explicit DB ID to use.
879
     *
880
     * @return string The explicit DB ID to use
881
     */
882
    public function getUseDbId()
883
    {
884
        return $this->useDbId;
885
    }
886
887
    /**
888
     * Set's the PID filename to use.
889
     *
890
     * @param string $pidFilename The PID filename to use
891
     *
892
     * @return void
893
     */
894
    public function setPidFilename($pidFilename)
895
    {
896
        $this->pidFilename = $pidFilename;
897
    }
898
899
    /**
900
     * Return's the PID filename to use.
901
     *
902
     * @return string The PID filename to use
903
     */
904
    public function getPidFilename()
905
    {
906
        return $this->pidFilename;
907
    }
908
909
    /**
910
     * Set's the systemm name to be used.
911
     *
912
     * @param string $systemName The system name to be used
913
     *
914
     * @return void
915
     */
916
    public function setSystemName($systemName)
917
    {
918
        $this->systemName = $systemName;
919
    }
920
921
    /**
922
     * Return's the systemm name to be used.
923
     *
924
     * @return string The system name to be used
925
     */
926
    public function getSystemName()
927
    {
928
        return $this->systemName;
929
    }
930
931
    /**
932
     * Set's the collection with the path of the Magento Edition specific extension libraries.
933
     *
934
     * @param array $extensionLibraries The paths of the Magento Edition specific extension libraries
935
     *
936
     * @return void
937
     */
938
    public function setExtensionLibraries(array $extensionLibraries)
939
    {
940
        $this->extensionLibraries = $extensionLibraries;
941
    }
942
943
    /**
944
     * Return's an array with the path of the Magento Edition specific extension libraries.
945
     *
946
     * @return array The paths of the Magento Edition specific extension libraries
947
     */
948
    public function getExtensionLibraries()
949
    {
950
        return $this->extensionLibraries;
951
    }
952
953
    /**
954
     * Return's a collection with the path to additional vendor directories.
955
     *
956
     * @return \Doctrine\Common\Collections\ArrayCollection The paths to additional vendor directories
957
     */
958
    public function getAdditionalVendorDirs()
959
    {
960
        return $this->additionalVendorDirs;
961
    }
962
963
    /**
964
     * Lifecycle callback that will be invoked after deserialization.
965
     *
966
     * @return void
967
     * @PostDeserialize
968
     */
969
    public function postDeserialize()
970
    {
971
972
        // create an empty collection if no operations has been specified
973
        if ($this->loggers === null) {
974
            $this->loggers = new ArrayCollection();
975
        }
976
977
        // create an empty collection if no operations has been specified
978
        if ($this->operations === null) {
979
            $this->operations = new ArrayCollection();
980
        }
981
982
        // create an empty collection if no loggers has been specified
983
        if ($this->additionalVendorDirs === null) {
984
            $this->additionalVendorDirs = new ArrayCollection();
985
        }
986
    }
987
988
    /**
989
     * The array with the subject's custom header mappings.
990
     *
991
     * @return array The custom header mappings
992
     */
993
    public function getHeaderMappings()
994
    {
995
996
        // initialize the array for the custom header mappings
997
        $headerMappings = array();
998
999
        // try to load the configured header mappings
1000
        if ($headerMappingsAvailable = reset($this->headerMappings)) {
1001
            $headerMappings = $headerMappingsAvailable;
1002
        }
1003
1004
        // return the custom header mappings
1005
        return $headerMappings;
1006
    }
1007
1008
    /**
1009
     * The array with the subject's custom image types.
1010
     *
1011
     * @return array The custom image types
1012
     */
1013
    public function getImageTypes()
1014
    {
1015
1016
        // initialize the array for the custom image types
1017
        $imageTypes = array();
1018
1019
        // try to load the configured image types
1020
        if ($imageTypesAvailable = reset($this->imageTypes)) {
1021
            $imageTypes = $imageTypesAvailable;
1022
        }
1023
1024
        // return the custom image types
1025
        return $imageTypes;
1026
    }
1027
}
1028