Completed
Push — master ( 0d5cb2...ca808c )
by Frederik
8s
created

Message::addRecords()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 1
ccs 0
cts 0
cp 0
nc 1
1
<?php
2
3
namespace Genkgo\Camt\Decoder;
4
5
use DateTimeImmutable;
6
use SimpleXMLElement;
7
use Genkgo\Camt\DTO;
8
use Genkgo\Camt\Iban;
9
10
abstract class Message
11
{
12
    /**
13
     * @var Record
14
     */
15
    protected $recordDecoder;
16
17 23
    public function __construct(Record $recordDecoder)
18
    {
19 23
        $this->recordDecoder = $recordDecoder;
20 23
    }
21
22
    /**
23
     * @param DTO\Message      $message
24
     * @param SimpleXMLElement $document
25
     */
26 19
    public function addGroupHeader(DTO\Message $message, SimpleXMLElement $document)
27
    {
28 19
        $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...
29 19
        $groupHeader = new DTO\GroupHeader(
30 19
            (string)$xmlGroupHeader->MsgId,
31 19
            new DateTimeImmutable((string)$xmlGroupHeader->CreDtTm)
32 19
        );
33
34 19
        $message->setGroupHeader($groupHeader);
35 19
    }
36
37
    /**
38
     * @param DTO\Message      $message
39
     * @param SimpleXMLElement $document
40
     */
41
    abstract public function addRecords(DTO\Message $message, SimpleXMLElement $document);
42
43
    /**
44
     * @param SimpleXMLElement $document
45
     *
46
     * @return SimpleXMLElement
47
     */
48
    abstract public function getRootElement(SimpleXMLElement $document);
49
}
50