Completed
Pull Request — master (#70)
by Jean-Louis
01:42
created

Config   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 7
dl 0
loc 66
ccs 24
cts 24
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addMessageFormat() 0 4 1
A getMessageFormats() 0 4 1
A disableXsdValidation() 0 4 1
A getXsdValidation() 0 4 1
A getDefault() 0 13 1
A noValidate() 0 7 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
    private $xsdValidation = true;
21
22
    /**
23
     * @param MessageFormatInterface $messageFormat
24
     */
25 6
    public function addMessageFormat(MessageFormatInterface $messageFormat)
26
    {
27 6
        $this->messageFormats[] = $messageFormat;
28 6
    }
29
30
    /**
31
     * @return MessageFormatInterface[]
32
     */
33 3
    public function getMessageFormats()
34
    {
35 3
        return $this->messageFormats;
36
    }
37
38 2
    public function disableXsdValidation()
39
    {
40 2
        $this->xsdValidation = false;
41 2
    }
42
43
    /**
44
     * @return bool
45
     */
46 4
    public function getXsdValidation()
47
    {
48 4
        return $this->xsdValidation;
49
    }
50
51
    /**
52
     * @return static
53
     */
54 4
    public static function getDefault()
55
    {
56 4
        $config = new static;
57 4
        $config->addMessageFormat(new Camt052\MessageFormat\V01());
58 4
        $config->addMessageFormat(new Camt052\MessageFormat\V04());
59 4
        $config->addMessageFormat(new Camt053\MessageFormat\V02());
60 4
        $config->addMessageFormat(new Camt053\MessageFormat\V03());
61 4
        $config->addMessageFormat(new Camt053\MessageFormat\V04());
62 4
        $config->addMessageFormat(new Camt054\MessageFormat\V02());
63 4
        $config->addMessageFormat(new Camt054\MessageFormat\V04());
64
65 4
        return $config;
66
    }
67
68
    /**
69
     * @return Config
70
     */
71 2
    public static function noValidate()
72
    {
73 2
        $config = static::getDefault();
74 2
        $config->disableXsdValidation();
75
76 2
        return $config;
77
    }
78
}
79