Completed
Push — master ( ca808c...de2f5d )
by Frederik
02:56
created

Message   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 34
ccs 22
cts 22
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B addGroupHeader() 0 28 4
1
<?php
2
3
namespace Genkgo\Camt\Camt054\Decoder\V04;
4
5
use Genkgo\Camt\Camt054\Decoder\Message as BaseMessage;
6
use Genkgo\Camt\Camt054\DTO\V04 as Camt054V04DTO;
7
use Genkgo\Camt\DTO;
8
use SimpleXMLElement;
9
use DateTimeImmutable;
10
11
class Message extends BaseMessage
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 3
    public function addGroupHeader(DTO\Message $message, SimpleXMLElement $document)
17
    {
18 3
        $xmlGroupHeader = $this->getRootElement($document)->GrpHdr;
0 ignored issues
show
Bug introduced by
The property GrpHdr does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
19 3
        $groupHeader = new Camt054V04DTO\GroupHeader(
20 3
            (string)$xmlGroupHeader->MsgId,
21 3
            new DateTimeImmutable((string)$xmlGroupHeader->CreDtTm)
22 3
        );
23
24 3
        if (isset($xmlGroupHeader->OrgnlBizQry)) {
25 3
            $originalBusinessQuery = new Camt054V04DTO\OriginalBusinessQuery(
26 3
                (string) $xmlGroupHeader->OrgnlBizQry->MsgId
27 3
            );
28
29 3
            if (isset($xmlGroupHeader->OrgnlBizQry->CreDtTm)) {
30 3
                $originalBusinessQuery->setCreatedOn(
31 3
                    new DateTimeImmutable((string) $xmlGroupHeader->OrgnlBizQry->CreDtTm)
32 3
                );
33 3
            }
34
35 3
            if (isset($xmlGroupHeader->OrgnlBizQry->MsgNmId)) {
36 3
                $originalBusinessQuery->setMessageNameId((string) $xmlGroupHeader->OrgnlBizQry->MsgNmId);
37 3
            }
38
39 3
            $groupHeader->setOriginalBusinessQuery($originalBusinessQuery);
40 3
        }
41
42 3
        $message->setGroupHeader($groupHeader);
43 3
    }
44
}
45