Completed
Pull Request — master (#12)
by Tim
01:31
created

Configuration::getLogLevel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
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\Jms\Configuration\Operation;
32
use TechDivision\Import\Configuration\DatabaseConfigurationInterface;
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
     * Array with the information of the configured loggers.
152
     *
153
     * @var array
154
     * @Type("array")
155
     */
156
    protected $loggers = array();
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
     * Return's the array with the plugins of the operation to use.
327
     *
328
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the plugins
329
     * @throws \Exception Is thrown, if no plugins are available for the actual operation
330
     */
331
    public function getPlugins()
332
    {
333
334
        // iterate over the operations and return the subjects of the actual one
335
        /** @var TechDivision\Import\Configuration\OperationInterface $operation */
336
        foreach ($this->getOperations() as $operation) {
337
            if ($this->getOperation()->equals($operation)) {
338
                return $operation->getPlugins();
339
            }
340
        }
341
342
        // throw an exception if no plugins are available
343
        throw new \Exception(sprintf('Can\'t find any plugins for operation %s', $this->getOperation()));
344
    }
345
346
    /**
347
     * Map's the passed value to a boolean.
348
     *
349
     * @param string $value The value to map
350
     *
351
     * @return boolean The mapped value
352
     * @throws \Exception Is thrown, if the value can't be mapped
353
     */
354
    public function mapBoolean($value)
355
    {
356
357
        // try to map the passed value to a boolean
358
        if (isset($this->booleanMapping[$value])) {
359
            return $this->booleanMapping[$value];
360
        }
361
362
        // throw an exception if we can't convert the passed value
363
        throw new \Exception(sprintf('Can\'t convert %s to boolean', $value));
364
    }
365
366
    /**
367
     * Return's the operation, initialize from the actual operation name.
368
     *
369
     * @return \TechDivision\Import\Configuration\OperationInterface The operation instance
370
     */
371
    protected function getOperation()
372
    {
373
        return new Operation($this->getOperationName());
374
    }
375
376
    /**
377
     * Return's the operation name that has to be used.
378
     *
379
     * @param string $operationName The operation name that has to be used
380
     *
381
     * @return void
382
     */
383
    public function setOperationName($operationName)
384
    {
385
        return $this->operationName = $operationName;
386
    }
387
388
    /**
389
     * Return's the operation name that has to be used.
390
     *
391
     * @return string The operation name that has to be used
392
     */
393
    public function getOperationName()
394
    {
395
        return $this->operationName;
396
    }
397
398
    /**
399
     * Set's the Magento installation directory.
400
     *
401
     * @param string $installationDir The Magento installation directory
402
     *
403
     * @return void
404
     */
405
    public function setInstallationDir($installationDir)
406
    {
407
        $this->installationDir = $installationDir;
408
    }
409
410
    /**
411
     * Return's the Magento installation directory.
412
     *
413
     * @return string The Magento installation directory
414
     */
415
    public function getInstallationDir()
416
    {
417
        return $this->installationDir;
418
    }
419
420
    /**
421
     * Set's the source directory that has to be watched for new files.
422
     *
423
     * @param string $sourceDir The source directory
424
     *
425
     * @return void
426
     */
427
    public function setSourceDir($sourceDir)
428
    {
429
        $this->sourceDir = $sourceDir;
430
    }
431
432
    /**
433
     * Return's the source directory that has to be watched for new files.
434
     *
435
     * @return string The source directory
436
     */
437
    public function getSourceDir()
438
    {
439
        return $this->sourceDir;
440
    }
441
442
    /**
443
     * Set's the target directory with the files that has been imported.
444
     *
445
     * @param string $targetDir The target directory
446
     *
447
     * @return void
448
     */
449
    public function setTargetDir($targetDir)
450
    {
451
        $this->targetDir = $targetDir;
452
    }
453
454
    /**
455
     * Return's the target directory with the files that has been imported.
456
     *
457
     * @return string The target directory
458
     */
459
    public function getTargetDir()
460
    {
461
        return $this->targetDir;
462
    }
463
464
    /**
465
     * Set's the Magento edition, EE or CE.
466
     *
467
     * @param string $magentoEdition The Magento edition
468
     *
469
     * @return void
470
     */
471
    public function setMagentoEdition($magentoEdition)
472
    {
473
        $this->magentoEdition = $magentoEdition;
474
    }
475
476
    /**
477
     * Return's the Magento edition, EE or CE.
478
     *
479
     * @return string The Magento edition
480
     */
481
    public function getMagentoEdition()
482
    {
483
        return $this->magentoEdition;
484
    }
485
486
    /**
487
     * Return's the Magento version, e. g. 2.1.0.
488
     *
489
     * @param string $magentoVersion The Magento version
490
     *
491
     * @return void
492
     */
493
    public function setMagentoVersion($magentoVersion)
494
    {
495
        $this->magentoVersion = $magentoVersion;
496
    }
497
498
    /**
499
     * Return's the Magento version, e. g. 2.1.0.
500
     *
501
     * @return string The Magento version
502
     */
503
    public function getMagentoVersion()
504
    {
505
        return $this->magentoVersion;
506
    }
507
508
    /**
509
     * Return's the subject's source date format to use.
510
     *
511
     * @return string The source date format
512
     */
513
    public function getSourceDateFormat()
514
    {
515
        return $this->sourceDateFormat;
516
    }
517
518
    /**
519
     * Set's the subject's source date format to use.
520
     *
521
     * @param string $sourceDateFormat The source date format
522
     *
523
     * @return void
524
     */
525
    public function setSourceDateFormat($sourceDateFormat)
526
    {
527
        $this->sourceDateFormat = $sourceDateFormat;
528
    }
529
530
    /**
531
     * Return's the entity type code to be used.
532
     *
533
     * @return string The entity type code to be used
534
     */
535
    public function getEntityTypeCode()
536
    {
537
        return $this->entityTypeCode;
538
    }
539
540
    /**
541
     * Set's the entity type code to be used.
542
     *
543
     * @param string $entityTypeCode The entity type code
544
     *
545
     * @return void
546
     */
547
    public function setEntityTypeCode($entityTypeCode)
548
    {
549
        $this->entityTypeCode = $entityTypeCode;
550
    }
551
552
    /**
553
     * Return's the multiple field delimiter character to use, default value is comma (,).
554
     *
555
     * @return string The multiple field delimiter character
556
     */
557
    public function getMultipleFieldDelimiter()
558
    {
559
        return $this->multipleFieldDelimiter;
560
    }
561
562
    /**
563
     * Return's the multiple value delimiter character to use, default value is comma (|).
564
     *
565
     * @return string The multiple value delimiter character
566
     */
567
    public function getMultipleValueDelimiter()
568
    {
569
        return $this->multipleValueDelimiter;
570
    }
571
572
    /**
573
     * Return's the delimiter character to use, default value is comma (,).
574
     *
575
     * @return string The delimiter character
576
     */
577
    public function getDelimiter()
578
    {
579
        return $this->delimiter;
580
    }
581
582
    /**
583
     * The enclosure character to use, default value is double quotation (").
584
     *
585
     * @return string The enclosure character
586
     */
587
    public function getEnclosure()
588
    {
589
        return $this->enclosure;
590
    }
591
592
    /**
593
     * The escape character to use, default value is backslash (\).
594
     *
595
     * @return string The escape character
596
     */
597
    public function getEscape()
598
    {
599
        return $this->escape;
600
    }
601
602
    /**
603
     * The file encoding of the CSV source file, default value is UTF-8.
604
     *
605
     * @return string The charset used by the CSV source file
606
     */
607
    public function getFromCharset()
608
    {
609
        return $this->fromCharset;
610
    }
611
612
    /**
613
     * The file encoding of the CSV targetfile, default value is UTF-8.
614
     *
615
     * @return string The charset used by the CSV target file
616
     */
617
    public function getToCharset()
618
    {
619
        return $this->toCharset;
620
    }
621
622
    /**
623
     * The file mode of the CSV target file, either one of write or append, default is write.
624
     *
625
     * @return string The file mode of the CSV target file
626
     */
627
    public function getFileMode()
628
    {
629
        return $this->fileMode;
630
    }
631
632
    /**
633
     * Queries whether or not strict mode is enabled or not, default is TRUE.
634
     *
635
     * @return boolean TRUE if strict mode is enabled, else FALSE
636
     */
637
    public function isStrictMode()
638
    {
639
        return $this->strictMode;
640
    }
641
642
    /**
643
     * Remove's all configured database configuration.
644
     *
645
     * @return void
646
     */
647
    public function clearDatabases()
648
    {
649
        $this->databases->clear();
650
    }
651
652
    /**
653
     * Add's the passed database configuration.
654
     *
655
     * @param \TechDivision\Import\Configuration\DatabaseConfigurationInterface $database The database configuration
656
     *
657
     * @return void
658
     */
659
    public function addDatabase(DatabaseConfigurationInterface $database)
660
    {
661
        $this->databases->add($database);
662
    }
663
664
    /**
665
     * Return's the number database configurations.
666
     *
667
     * @return integer The number of database configurations
668
     */
669
    public function countDatabases()
670
    {
671
        return $this->databases->count();
672
    }
673
674
    /**
675
     * Return's the database configuration.
676
     *
677
     * If an explicit DB ID is specified, the method tries to return the database with this ID. If
678
     * the database configuration is NOT available, an execption is thrown.
679
     *
680
     * If no explicit DB ID is specified, the method tries to return the default database configuration,
681
     * if not available the first one.
682
     *
683
     * @return \TechDivision\Import\Configuration\Jms\Configuration\Database The database configuration
684
     * @throws \Exception Is thrown, if no database configuration is available
685
     */
686
    public function getDatabase()
687
    {
688
689
        // if a DB ID has been set, try to load the database
690
        if ($useDbId = $this->getUseDbId()) {
691
            // iterate over the configured databases and return the one with the passed ID
692
            /** @var TechDivision\Import\Configuration\DatabaseInterface  $database */
693
            foreach ($this->databases as $database) {
694
                if ($database->getId() === $useDbId) {
695
                    return $database;
696
                }
697
            }
698
699
            // throw an exception, if the database with the passed ID is NOT configured
700
            throw new \Exception(sprintf('Database with ID %s can not be found', $useDbId));
701
        }
702
703
        // iterate over the configured databases and try return the default database
704
        /** @var TechDivision\Import\Configuration\DatabaseInterface  $database */
705
        foreach ($this->databases as $database) {
706
            if ($database->isDefault()) {
707
                return $database;
708
            }
709
        }
710
711
        // try to return the first database configurtion
712
        if ($this->databases->count() > 0) {
713
            return $this->databases->first();
714
        }
715
716
        // throw an exception, if no database configuration is available
717
        throw new \Exception('There is no database configuration available');
718
    }
719
720
    /**
721
     * Return's the ArrayCollection with the configured operations.
722
     *
723
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the operations
724
     */
725
    public function getOperations()
726
    {
727
        return $this->operations;
728
    }
729
730
    /**
731
     * Return's the ArrayCollection with the configured loggers.
732
     *
733
     * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the loggers
734
     */
735
    public function getLoggers()
736
    {
737
        return $this->loggers;
738
    }
739
740
    /**
741
     * Set's the flag that import artefacts have to be archived or not.
742
     *
743
     * @param boolean $archiveArtefacts TRUE if artefacts have to be archived, else FALSE
744
     *
745
     * @return void
746
     */
747
    public function setArchiveArtefacts($archiveArtefacts)
748
    {
749
        $this->archiveArtefacts = $archiveArtefacts;
750
    }
751
752
    /**
753
     * Return's the TRUE if the import artefacts have to be archived.
754
     *
755
     * @return boolean TRUE if the import artefacts have to be archived
756
     */
757
    public function haveArchiveArtefacts()
758
    {
759
        return $this->archiveArtefacts;
760
    }
761
762
    /**
763
     * The directory where the archives will be stored.
764
     *
765
     * @param string $archiveDir The archive directory
766
     *
767
     * @return void
768
     */
769
    public function setArchiveDir($archiveDir)
770
    {
771
        $this->archiveDir = $archiveDir;
772
    }
773
774
    /**
775
     * The directory where the archives will be stored.
776
     *
777
     * @return string The archive directory
778
     */
779
    public function getArchiveDir()
780
    {
781
        return $this->archiveDir;
782
    }
783
784
    /**
785
     * Set's the debug mode.
786
     *
787
     * @param boolean $debugMode TRUE if debug mode is enabled, else FALSE
788
     *
789
     * @return void
790
     */
791
    public function setDebugMode($debugMode)
792
    {
793
        $this->debugMode = $debugMode;
794
    }
795
796
    /**
797
     * Queries whether or not debug mode is enabled or not, default is TRUE.
798
     *
799
     * @return boolean TRUE if debug mode is enabled, else FALSE
800
     */
801
    public function isDebugMode()
802
    {
803
        return $this->debugMode;
804
    }
805
806
    /**
807
     * Set's the log level to use.
808
     *
809
     * @param string $logLevel The log level to use
810
     *
811
     * @return void
812
     */
813
    public function setLogLevel($logLevel)
814
    {
815
        $this->logLevel = $logLevel;
816
    }
817
818
    /**
819
     * Return's the log level to use.
820
     *
821
     * @return string The log level to use
822
     */
823
    public function getLogLevel()
824
    {
825
        return $this->logLevel;
826
    }
827
828
    /**
829
     * Set's the explicit DB ID to use.
830
     *
831
     * @param string $useDbId The explicit DB ID to use
832
     *
833
     * @return void
834
     */
835
    public function setUseDbId($useDbId)
836
    {
837
        $this->useDbId = $useDbId;
838
    }
839
840
    /**
841
     * Return's the explicit DB ID to use.
842
     *
843
     * @return string The explicit DB ID to use
844
     */
845
    public function getUseDbId()
846
    {
847
        return $this->useDbId;
848
    }
849
850
    /**
851
     * Set's the PID filename to use.
852
     *
853
     * @param string $pidFilename The PID filename to use
854
     *
855
     * @return void
856
     */
857
    public function setPidFilename($pidFilename)
858
    {
859
        $this->pidFilename = $pidFilename;
860
    }
861
862
    /**
863
     * Return's the PID filename to use.
864
     *
865
     * @return string The PID filename to use
866
     */
867
    public function getPidFilename()
868
    {
869
        return $this->pidFilename;
870
    }
871
872
    /**
873
     * Set's the systemm name to be used.
874
     *
875
     * @param string $systemName The system name to be used
876
     *
877
     * @return void
878
     */
879
    public function setSystemName($systemName)
880
    {
881
        $this->systemName = $systemName;
882
    }
883
884
    /**
885
     * Return's the systemm name to be used.
886
     *
887
     * @return string The system name to be used
888
     */
889
    public function getSystemName()
890
    {
891
        return $this->systemName;
892
    }
893
894
    /**
895
     * Set's the collection with the path of the Magento Edition specific extension libraries.
896
     *
897
     * @param array $extensionLibraries The paths of the Magento Edition specific extension libraries
898
     *
899
     * @return void
900
     */
901
    public function setExtensionLibraries(array $extensionLibraries)
902
    {
903
        $this->extensionLibraries = $extensionLibraries;
904
    }
905
906
    /**
907
     * Return's an array with the path of the Magento Edition specific extension libraries.
908
     *
909
     * @return array The paths of the Magento Edition specific extension libraries
910
     */
911
    public function getExtensionLibraries()
912
    {
913
        return $this->extensionLibraries;
914
    }
915
916
    /**
917
     * Return's a collection with the path to additional vendor directories.
918
     *
919
     * @return \Doctrine\Common\Collections\ArrayCollection The paths to additional vendor directories
920
     */
921
    public function getAdditionalVendorDirs()
922
    {
923
        return $this->additionalVendorDirs;
924
    }
925
926
    /**
927
     * Lifecycle callback that will be invoked after deserialization.
928
     *
929
     * @return void
930
     * @PostDeserialize
931
     */
932
    public function postDeserialize()
933
    {
934
935
        // create an empty collection if no loggers has been specified
936
        if ($this->additionalVendorDirs === null) {
937
            $this->additionalVendorDirs = new ArrayCollection();
938
        }
939
940
        // create an empty collection if no operations has been specified
941
        if ($this->operations === null) {
942
            $this->operations = new ArrayCollection();
943
        }
944
    }
945
}
946