Completed
Push — master ( db9f02...f00f69 )
by Tim
13s
created

Configuration   F

Complexity

Total Complexity 68

Size/Duplication

Total Lines 964
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 68
c 3
b 0
f 0
lcom 5
cbo 3
dl 0
loc 964
rs 2.3529

54 Methods

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