Completed
Push — 9.x ( 6695e2 )
by Tim
04:31
created

Configuration::isCacheEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
use TechDivision\Import\Configuration\Jms\Configuration\ParamsTrait;
34
use TechDivision\Import\Configuration\Jms\Configuration\CsvTrait;
35
use TechDivision\Import\Configuration\Jms\Configuration\ListenersTrait;
36
37
/**
38
 * A simple JMS based configuration implementation.
39
 *
40
 * @author    Tim Wagner <[email protected]>
41
 * @copyright 2016 TechDivision GmbH <[email protected]>
42
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
43
 * @link      https://github.com/techdivision/import-configuration-jms
44
 * @link      http://www.techdivision.com
45
 *
46
 * @ExclusionPolicy("none")
47
 */
48
class Configuration implements ConfigurationInterface
49
{
50
51
    /**
52
     * The default PID filename to use.
53
     *
54
     * @var string
55
     */
56
    const PID_FILENAME = 'importer.pid';
57
58
    /**
59
     * Trait that provides CSV configuration functionality.
60
     *
61
     * @var \TechDivision\Import\Configuration\Jms\Configuration\CsvTrait
62
     */
63
    use CsvTrait;
64
65
    /**
66
     * Trait that provides CSV configuration functionality.
67
     *
68
     * @var \TechDivision\Import\Configuration\Jms\Configuration\ParamsTrait
69
     */
70
    use ParamsTrait;
71
72
    /**
73
     * Trait that provides CSV configuration functionality.
74
     *
75
     * @var \TechDivision\Import\Configuration\Jms\Configuration\ListenersTrait
76
     */
77
    use ListenersTrait;
78
79
    /**
80
     * Mapping for boolean values passed on the console.
81
     *
82
     * @var array
83
     * @Exclude
84
     */
85
    protected $booleanMapping = array(
86
        'true'  => true,
87
        'false' => false,
88
        '1'     => true,
89
        '0'     => false,
90
        'on'    => true,
91
        'off'   => false
92
    );
93
94
    /**
95
     * The application's unique DI identifier.
96
     *
97
     * @var string
98
     * @Type("string")
99
     * @SerializedName("id")
100
     */
101
    protected $id;
102
103
    /**
104
     * The system name to use.
105
     *
106
     * @var string
107
     * @Type("string")
108
     * @SerializedName("system-name")
109
     */
110
    protected $systemName;
111
112
    /**
113
     * The operation name to use.
114
     *
115
     * @var string
116
     * @Type("string")
117
     * @SerializedName("operation-name")
118
     */
119
    protected $operationName;
120
121
    /**
122
     * The entity type code to use.
123
     *
124
     * @var string
125
     * @Type("string")
126
     * @SerializedName("entity-type-code")
127
     */
128
    protected $entityTypeCode;
129
130
    /**
131
     * The Magento installation directory.
132
     *
133
     * @var string
134
     * @Type("string")
135
     * @SerializedName("installation-dir")
136
     */
137
    protected $installationDir;
138
139
    /**
140
     * The source directory that has to be watched for new files.
141
     *
142
     * @var string
143
     * @Type("string")
144
     * @SerializedName("source-dir")
145
     */
146
    protected $sourceDir;
147
148
    /**
149
     * The target directory with the files that has been imported.
150
     *
151
     * @var string
152
     * @Type("string")
153
     * @SerializedName("target-dir")
154
     */
155
    protected $targetDir;
156
157
    /**
158
     * The Magento edition, EE or CE.
159
     *
160
     * @var string
161
     * @Type("string")
162
     * @SerializedName("magento-edition")
163
     */
164
    protected $magentoEdition = 'CE';
165
166
    /**
167
     * The Magento version, e. g. 2.1.0.
168
     *
169
     * @var string
170
     * @Type("string")
171
     * @SerializedName("magento-version")
172
     */
173
    protected $magentoVersion = '2.1.2';
174
175
    /**
176
     * ArrayCollection with the information of the configured databases.
177
     *
178
     * @var \Doctrine\Common\Collections\ArrayCollection
179
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Database>")
180
     */
181
    protected $databases;
182
183
    /**
184
     * ArrayCollection with the information of the configured loggers.
185
     *
186
     * @var \Doctrine\Common\Collections\ArrayCollection
187
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Logger>")
188
     */
189
    protected $loggers;
190
191
    /**
192
     * ArrayCollection with the information of the configured operations.
193
     *
194
     * @var \Doctrine\Common\Collections\ArrayCollection
195
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Operation>")
196
     */
197
    protected $operations;
198
199
    /**
200
     * The subject's multiple field delimiter character for fields with multiple values, defaults to (,).
201
     *
202
     * @var string
203
     * @Type("string")
204
     * @SerializedName("multiple-field-delimiter")
205
     */
206
    protected $multipleFieldDelimiter = ',';
207
208
    /**
209
     * The subject's multiple value delimiter character for fields with multiple values, defaults to (|).
210
     *
211
     * @var string
212
     * @Type("string")
213
     * @SerializedName("multiple-value-delimiter")
214
     */
215
    protected $multipleValueDelimiter = '|';
216
217
    /**
218
     * The flag to signal that the subject has to use the strict mode or not.
219
     *
220
     * @var boolean
221
     * @Type("boolean")
222
     * @SerializedName("strict-mode")
223
     */
224
    protected $strictMode;
225
226
    /**
227
     * The flag whether or not the import artefacts have to be archived.
228
     *
229
     * @var boolean
230
     * @Type("boolean")
231
     * @SerializedName("archive-artefacts")
232
     */
233
    protected $archiveArtefacts;
234
235
    /**
236
     * The directory where the archives will be stored.
237
     *
238
     * @var string
239
     * @Type("string")
240
     * @SerializedName("archive-dir")
241
     */
242
    protected $archiveDir;
243
244
    /**
245
     * The flag to signal that the subject has to use the debug mode or not.
246
     *
247
     * @var boolean
248
     * @Type("boolean")
249
     * @SerializedName("debug-mode")
250
     */
251
    protected $debugMode = false;
252
253
    /**
254
     * The log level to use (see Monolog documentation).
255
     *
256
     * @var string
257
     * @Type("string")
258
     * @SerializedName("log-level")
259
     */
260
    protected $logLevel = LogLevel::INFO;
261
262
    /**
263
     * The explicit DB ID to use.
264
     *
265
     * @var string
266
     * @Type("string")
267
     * @SerializedName("use-db-id")
268
     */
269
    protected $useDbId;
270
271
    /**
272
     * The explicit PID filename to use.
273
     *
274
     * @var string
275
     * @Type("string")
276
     * @SerializedName("pid-filename")
277
     */
278
    protected $pidFilename;
279
280
    /**
281
     * The collection with the paths to additional vendor directories.
282
     *
283
     * @var \Doctrine\Common\Collections\ArrayCollection
284
     * @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\VendorDir>")
285
     * @SerializedName("additional-vendor-dirs")
286
     */
287
    protected $additionalVendorDirs;
288
289
    /**
290
     * The array with the Magento Edition specific extension libraries.
291
     *
292
     * @var array
293
     * @Type("array")
294
     * @SerializedName("extension-libraries")
295
     */
296
    protected $extensionLibraries = array();
297
298
    /**
299
     * The array with the custom header mappings.
300
     *
301
     * @var array
302
     * @Type("array")
303
     * @SerializedName("header-mappings")
304
     */
305
    protected $headerMappings = array();
306
307
    /**
308
     * The array with the custom image types.
309
     *
310
     * @var array
311
     * @Type("array")
312
     * @SerializedName("image-types")
313
     */
314
    protected $imageTypes = array();
315
316
    /**
317
     * The flag to signal that the import should be wrapped within a single transation or not.
318
     *
319
     * @var boolean
320
     * @Type("boolean")
321
     * @SerializedName("single-transaction")
322
     */
323
    protected $singleTransaction = false;
324
325
    /**
326
     * The flag to signal that the cache should be enabled or not.
327
     *
328
     * @var boolean
329
     * @Type("boolean")
330
     * @SerializedName("cache-enabled")
331
     */
332
    protected $cacheEnabled = true;
333
334
    /**
335
     * Return's the array with the plugins of the operation to use.
336
     *
337
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the plugins
338
     * @throws \Exception Is thrown, if no plugins are available for the actual operation
339
     */
340
    public function getPlugins()
341
    {
342
343
        // iterate over the operations and return the subjects of the actual one
344
        /** @var TechDivision\Import\Configuration\OperationInterface $operation */
345
        foreach ($this->getOperations() as $operation) {
346
            if ($this->getOperation()->equals($operation)) {
347
                return $operation->getPlugins();
348
            }
349
        }
350
351
        // throw an exception if no plugins are available
352
        throw new \Exception(sprintf('Can\'t find any plugins for operation %s', $this->getOperation()));
353
    }
354
355
    /**
356
     * Map's the passed value to a boolean.
357
     *
358
     * @param string $value The value to map
359
     *
360
     * @return boolean The mapped value
361
     * @throws \Exception Is thrown, if the value can't be mapped
362
     */
363
    public function mapBoolean($value)
364
    {
365
366
        // try to map the passed value to a boolean
367
        if (isset($this->booleanMapping[$value])) {
368
            return $this->booleanMapping[$value];
369
        }
370
371
        // throw an exception if we can't convert the passed value
372
        throw new \Exception(sprintf('Can\'t convert %s to boolean', $value));
373
    }
374
375
    /**
376
     * Return's the operation, initialize from the actual operation name.
377
     *
378
     * @return \TechDivision\Import\Configuration\OperationConfigurationInterface The operation instance
379
     */
380
    public function getOperation()
381
    {
382
        return new Operation($this->getOperationName());
383
    }
384
385
    /**
386
     * Return's the application's unique DI identifier.
387
     *
388
     * @return string The application's unique DI identifier
389
     */
390
    public function getId()
391
    {
392
        return $this->id;
393
    }
394
395
    /**
396
     * Return's the operation name that has to be used.
397
     *
398
     * @param string $operationName The operation name that has to be used
399
     *
400
     * @return void
401
     */
402
    public function setOperationName($operationName)
403
    {
404
        return $this->operationName = $operationName;
405
    }
406
407
    /**
408
     * Return's the operation name that has to be used.
409
     *
410
     * @return string The operation name that has to be used
411
     */
412
    public function getOperationName()
413
    {
414
        return $this->operationName;
415
    }
416
417
    /**
418
     * Set's the Magento installation directory.
419
     *
420
     * @param string $installationDir The Magento installation directory
421
     *
422
     * @return void
423
     */
424
    public function setInstallationDir($installationDir)
425
    {
426
        $this->installationDir = $installationDir;
427
    }
428
429
    /**
430
     * Return's the Magento installation directory.
431
     *
432
     * @return string The Magento installation directory
433
     */
434
    public function getInstallationDir()
435
    {
436
        return $this->installationDir;
437
    }
438
439
    /**
440
     * Set's the source directory that has to be watched for new files.
441
     *
442
     * @param string $sourceDir The source directory
443
     *
444
     * @return void
445
     */
446
    public function setSourceDir($sourceDir)
447
    {
448
        $this->sourceDir = $sourceDir;
449
    }
450
451
    /**
452
     * Return's the source directory that has to be watched for new files.
453
     *
454
     * @return string The source directory
455
     */
456
    public function getSourceDir()
457
    {
458
        return $this->sourceDir;
459
    }
460
461
    /**
462
     * Set's the target directory with the files that has been imported.
463
     *
464
     * @param string $targetDir The target directory
465
     *
466
     * @return void
467
     */
468
    public function setTargetDir($targetDir)
469
    {
470
        $this->targetDir = $targetDir;
471
    }
472
473
    /**
474
     * Return's the target directory with the files that has been imported.
475
     *
476
     * @return string The target directory
477
     */
478
    public function getTargetDir()
479
    {
480
        return $this->targetDir;
481
    }
482
483
    /**
484
     * Set's the Magento edition, EE or CE.
485
     *
486
     * @param string $magentoEdition The Magento edition
487
     *
488
     * @return void
489
     */
490
    public function setMagentoEdition($magentoEdition)
491
    {
492
        $this->magentoEdition = $magentoEdition;
493
    }
494
495
    /**
496
     * Return's the Magento edition, EE or CE.
497
     *
498
     * @return string The Magento edition
499
     */
500
    public function getMagentoEdition()
501
    {
502
        return $this->magentoEdition;
503
    }
504
505
    /**
506
     * Return's the Magento version, e. g. 2.1.0.
507
     *
508
     * @param string $magentoVersion The Magento version
509
     *
510
     * @return void
511
     */
512
    public function setMagentoVersion($magentoVersion)
513
    {
514
        $this->magentoVersion = $magentoVersion;
515
    }
516
517
    /**
518
     * Return's the Magento version, e. g. 2.1.0.
519
     *
520
     * @return string The Magento version
521
     */
522
    public function getMagentoVersion()
523
    {
524
        return $this->magentoVersion;
525
    }
526
527
    /**
528
     * Set's the subject's source date format to use.
529
     *
530
     * @param string $sourceDateFormat The source date format
531
     *
532
     * @return void
533
     */
534
    public function setSourceDateFormat($sourceDateFormat)
535
    {
536
        $this->sourceDateFormat = $sourceDateFormat;
0 ignored issues
show
Bug introduced by
The property sourceDateFormat does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
537
    }
538
539
    /**
540
     * Return's the entity type code to be used.
541
     *
542
     * @return string The entity type code to be used
543
     */
544
    public function getEntityTypeCode()
545
    {
546
        return $this->entityTypeCode;
547
    }
548
549
    /**
550
     * Set's the entity type code to be used.
551
     *
552
     * @param string $entityTypeCode The entity type code
553
     *
554
     * @return void
555
     */
556
    public function setEntityTypeCode($entityTypeCode)
557
    {
558
        $this->entityTypeCode = $entityTypeCode;
559
    }
560
561
    /**
562
     * Return's the multiple field delimiter character to use, default value is comma (,).
563
     *
564
     * @return string The multiple field delimiter character
565
     */
566
    public function getMultipleFieldDelimiter()
567
    {
568
        return $this->multipleFieldDelimiter;
569
    }
570
571
    /**
572
     * Return's the multiple value delimiter character to use, default value is comma (|).
573
     *
574
     * @return string The multiple value delimiter character
575
     */
576
    public function getMultipleValueDelimiter()
577
    {
578
        return $this->multipleValueDelimiter;
579
    }
580
581
    /**
582
     * Queries whether or not strict mode is enabled or not, default is TRUE.
583
     *
584
     * @return boolean TRUE if strict mode is enabled, else FALSE
585
     */
586
    public function isStrictMode()
587
    {
588
        return $this->strictMode;
589
    }
590
591
    /**
592
     * Remove's all configured database configuration.
593
     *
594
     * @return void
595
     */
596
    public function clearDatabases()
597
    {
598
        $this->databases->clear();
599
    }
600
601
    /**
602
     * Add's the passed database configuration.
603
     *
604
     * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration
605
     *
606
     * @return void
607
     */
608
    public function addDatabase(DatabaseConfigurationInterface $database)
609
    {
610
        $this->databases->add($database);
611
    }
612
613
    /**
614
     * Return's the number database configurations.
615
     *
616
     * @return integer The number of database configurations
617
     */
618
    public function countDatabases()
619
    {
620
        return $this->databases->count();
621
    }
622
623
    /**
624
     * Return's the database configuration with the passed ID.
625
     *
626
     * @param string $id The ID of the database connection to return
627
     *
628
     * @return \TechDivision\Import\Configuration\DatabaseConfigurationInterface The database configuration
629
     * @throws \Exception Is thrown, if no database configuration is available
630
     */
631
    public function getDatabaseById($id)
632
    {
633
634
        // iterate over the configured databases and return the one with the passed ID
635
        /** @var TechDivision\Import\Configuration\DatabaseInterface  $database */
636
        foreach ($this->databases as $database) {
637
            if ($database->getId() === $id) {
638
                return $database;
639
            }
640
        }
641
642
        // throw an exception, if the database with the passed ID is NOT configured
643
        throw new \Exception(sprintf('Database with ID %s can not be found', $id));
644
    }
645
646
    /**
647
     * Return's the database configuration.
648
     *
649
     * If an explicit DB ID is specified, the method tries to return the database with this ID. If
650
     * the database configuration is NOT available, an execption is thrown.
651
     *
652
     * If no explicit DB ID is specified, the method tries to return the default database configuration,
653
     * if not available the first one.
654
     *
655
     * @return \TechDivision\Import\Configuration\DatabaseConfigurationInterface The database configuration
656
     * @throws \Exception Is thrown, if no database configuration is available
657
     */
658
    public function getDatabase()
659
    {
660
661
        // if a DB ID has been set, try to load the database
662
        if ($useDbId = $this->getUseDbId()) {
663
            return $this->getDatabaseById($useDbId);
664
        }
665
666
        // iterate over the configured databases and try return the default database
667
        /** @var TechDivision\Import\Configuration\DatabaseInterface  $database */
668
        foreach ($this->databases as $database) {
669
            if ($database->isDefault()) {
670
                return $database;
671
            }
672
        }
673
674
        // try to return the first database configurtion
675
        if ($this->databases->count() > 0) {
676
            return $this->databases->first();
677
        }
678
679
        // throw an exception, if no database configuration is available
680
        throw new \Exception('There is no database configuration available');
681
    }
682
683
    /**
684
     * Return's the ArrayCollection with the configured operations.
685
     *
686
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the operations
687
     */
688
    public function getOperations()
689
    {
690
        return $this->operations;
691
    }
692
693
    /**
694
     * Return's the ArrayCollection with the configured loggers.
695
     *
696
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the loggers
697
     */
698
    public function getLoggers()
699
    {
700
        return $this->loggers;
701
    }
702
703
    /**
704
     * Set's the flag that import artefacts have to be archived or not.
705
     *
706
     * @param boolean $archiveArtefacts TRUE if artefacts have to be archived, else FALSE
707
     *
708
     * @return void
709
     */
710
    public function setArchiveArtefacts($archiveArtefacts)
711
    {
712
        $this->archiveArtefacts = $archiveArtefacts;
713
    }
714
715
    /**
716
     * Return's the TRUE if the import artefacts have to be archived.
717
     *
718
     * @return boolean TRUE if the import artefacts have to be archived
719
     */
720
    public function haveArchiveArtefacts()
721
    {
722
        return $this->archiveArtefacts;
723
    }
724
725
    /**
726
     * The directory where the archives will be stored.
727
     *
728
     * @param string $archiveDir The archive directory
729
     *
730
     * @return void
731
     */
732
    public function setArchiveDir($archiveDir)
733
    {
734
        $this->archiveDir = $archiveDir;
735
    }
736
737
    /**
738
     * The directory where the archives will be stored.
739
     *
740
     * @return string The archive directory
741
     */
742
    public function getArchiveDir()
743
    {
744
        return $this->archiveDir;
745
    }
746
747
    /**
748
     * Set's the debug mode.
749
     *
750
     * @param boolean $debugMode TRUE if debug mode is enabled, else FALSE
751
     *
752
     * @return void
753
     */
754
    public function setDebugMode($debugMode)
755
    {
756
        $this->debugMode = $debugMode;
757
    }
758
759
    /**
760
     * Queries whether or not debug mode is enabled or not, default is TRUE.
761
     *
762
     * @return boolean TRUE if debug mode is enabled, else FALSE
763
     */
764
    public function isDebugMode()
765
    {
766
        return $this->debugMode;
767
    }
768
769
    /**
770
     * Set's the log level to use.
771
     *
772
     * @param string $logLevel The log level to use
773
     *
774
     * @return void
775
     */
776
    public function setLogLevel($logLevel)
777
    {
778
        $this->logLevel = $logLevel;
779
    }
780
781
    /**
782
     * Return's the log level to use.
783
     *
784
     * @return string The log level to use
785
     */
786
    public function getLogLevel()
787
    {
788
        return $this->logLevel;
789
    }
790
791
    /**
792
     * Set's the explicit DB ID to use.
793
     *
794
     * @param string $useDbId The explicit DB ID to use
795
     *
796
     * @return void
797
     */
798
    public function setUseDbId($useDbId)
799
    {
800
        $this->useDbId = $useDbId;
801
    }
802
803
    /**
804
     * Return's the explicit DB ID to use.
805
     *
806
     * @return string The explicit DB ID to use
807
     */
808
    public function getUseDbId()
809
    {
810
        return $this->useDbId;
811
    }
812
813
    /**
814
     * Set's the PID filename to use.
815
     *
816
     * @param string $pidFilename The PID filename to use
817
     *
818
     * @return void
819
     */
820
    public function setPidFilename($pidFilename)
821
    {
822
        $this->pidFilename = $pidFilename;
823
    }
824
825
    /**
826
     * Return's the PID filename to use.
827
     *
828
     * @return string The PID filename to use
829
     */
830
    public function getPidFilename()
831
    {
832
        return $this->pidFilename;
833
    }
834
835
    /**
836
     * Set's the systemm name to be used.
837
     *
838
     * @param string $systemName The system name to be used
839
     *
840
     * @return void
841
     */
842
    public function setSystemName($systemName)
843
    {
844
        $this->systemName = $systemName;
845
    }
846
847
    /**
848
     * Return's the systemm name to be used.
849
     *
850
     * @return string The system name to be used
851
     */
852
    public function getSystemName()
853
    {
854
        return $this->systemName;
855
    }
856
857
    /**
858
     * Set's the collection with the path of the Magento Edition specific extension libraries.
859
     *
860
     * @param array $extensionLibraries The paths of the Magento Edition specific extension libraries
861
     *
862
     * @return void
863
     */
864
    public function setExtensionLibraries(array $extensionLibraries)
865
    {
866
        $this->extensionLibraries = $extensionLibraries;
867
    }
868
869
    /**
870
     * Return's an array with the path of the Magento Edition specific extension libraries.
871
     *
872
     * @return array The paths of the Magento Edition specific extension libraries
873
     */
874
    public function getExtensionLibraries()
875
    {
876
        return $this->extensionLibraries;
877
    }
878
879
    /**
880
     * Return's a collection with the path to additional vendor directories.
881
     *
882
     * @return \Doctrine\Common\Collections\ArrayCollection The paths to additional vendor directories
883
     */
884
    public function getAdditionalVendorDirs()
885
    {
886
        return $this->additionalVendorDirs;
887
    }
888
889
    /**
890
     * Lifecycle callback that will be invoked after deserialization.
891
     *
892
     * @return void
893
     * @PostDeserialize
894
     */
895
    public function postDeserialize()
896
    {
897
898
        // create an empty collection if no operations has been specified
899
        if ($this->loggers === null) {
900
            $this->loggers = new ArrayCollection();
901
        }
902
903
        // create an empty collection if no operations has been specified
904
        if ($this->operations === null) {
905
            $this->operations = new ArrayCollection();
906
        }
907
908
        // create an empty collection if no loggers has been specified
909
        if ($this->additionalVendorDirs === null) {
910
            $this->additionalVendorDirs = new ArrayCollection();
911
        }
912
    }
913
914
    /**
915
     * The array with the subject's custom header mappings.
916
     *
917
     * @return array The custom header mappings
918
     */
919
    public function getHeaderMappings()
920
    {
921
922
        // initialize the array for the custom header mappings
923
        $headerMappings = array();
924
925
        // try to load the configured header mappings
926
        if ($headerMappingsAvailable = reset($this->headerMappings)) {
927
            $headerMappings = $headerMappingsAvailable;
928
        }
929
930
        // return the custom header mappings
931
        return $headerMappings;
932
    }
933
934
    /**
935
     * The array with the subject's custom image types.
936
     *
937
     * @return array The custom image types
938
     */
939
    public function getImageTypes()
940
    {
941
942
        // initialize the array for the custom image types
943
        $imageTypes = array();
944
945
        // try to load the configured image types
946
        if ($imageTypesAvailable = reset($this->imageTypes)) {
947
            $imageTypes = $imageTypesAvailable;
948
        }
949
950
        // return the custom image types
951
        return $imageTypes;
952
    }
953
954
    /**
955
     * Set's the flag that decides whether or not the import should be wrapped within a single transaction.
956
     *
957
     * @param boolean $singleTransaction TRUE if the import should be wrapped in a single transation, else FALSE
958
     *
959
     * @return void
960
     */
961
    public function setSingleTransaction($singleTransaction)
962
    {
963
        $this->singleTransaction = $singleTransaction;
964
    }
965
966
    /**
967
     * Whether or not the import should be wrapped within a single transation.
968
     *
969
     * @return boolean TRUE if the import should be wrapped in a single transation, else FALSE
970
     */
971
    public function isSingleTransaction()
972
    {
973
        return $this->singleTransaction;
974
    }
975
976
    /**
977
     * Set's the flag that decides whether or not the the cache has been enabled.
978
     *
979
     * @param boolean $cacheEnabled TRUE if the cache has been enabled, else FALSE
980
     *
981
     * @return void
982
     */
983
    public function setCacheEnabled($cacheEnabled)
984
    {
985
        $this->cacheEnabled = $cacheEnabled;
986
    }
987
988
    /**
989
     * Whether or not the cache functionality should be enabled.
990
     *
991
     * @return boolean TRUE if the cache has to be enabled, else FALSE
992
     */
993
    public function isCacheEnabled()
994
    {
995
        return $this->cacheEnabled;
996
    }
997
}
998