Completed
Push — master ( ede1e0...2b6209 )
by Adrien
01:46
created

Config::getXsdValidation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Genkgo\Camt;
4
5
use Genkgo\Camt\Camt052;
6
use Genkgo\Camt\Camt053;
7
use Genkgo\Camt\Camt054;
8
9
/**
10
 * Class Config
11
 * @package Genkgo\Camt
12
 */
13
class Config
14
{
15
    /**
16
     * @var MessageFormatInterface[]
17
     */
18
    private $messageFormats = [];
19
20
    /**
21
     * @var bool
22
     */
23
    private $xsdValidation = true;
24
25
    /**
26
     * @param MessageFormatInterface $messageFormat
27
     */
28 6
    public function addMessageFormat(MessageFormatInterface $messageFormat)
29
    {
30 6
        $this->messageFormats[] = $messageFormat;
31 6
    }
32
33
    /**
34
     * @return MessageFormatInterface[]
35
     */
36 3
    public function getMessageFormats()
37
    {
38 3
        return $this->messageFormats;
39
    }
40
41 2
    public function disableXsdValidation()
42
    {
43 2
        $this->xsdValidation = false;
44 2
    }
45
46
    /**
47
     * @return bool
48
     */
49 4
    public function getXsdValidation()
50
    {
51 4
        return $this->xsdValidation;
52
    }
53
54
    /**
55
     * @return static
56
     */
57 4
    public static function getDefault()
58
    {
59 4
        $config = new static;
60 4
        $config->addMessageFormat(new Camt052\MessageFormat\V01());
61 4
        $config->addMessageFormat(new Camt052\MessageFormat\V04());
62 4
        $config->addMessageFormat(new Camt053\MessageFormat\V02());
63 4
        $config->addMessageFormat(new Camt053\MessageFormat\V03());
64 4
        $config->addMessageFormat(new Camt053\MessageFormat\V04());
65 4
        $config->addMessageFormat(new Camt054\MessageFormat\V02());
66 4
        $config->addMessageFormat(new Camt054\MessageFormat\V04());
67
68 4
        return $config;
69
    }
70
}
71