Issues (38)

src/Pohoda/AddressBook/Header.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace kalanis\Pohoda\AddressBook;
6
7
use kalanis\Pohoda\AbstractAgenda;
8
use kalanis\Pohoda\Common;
9
use kalanis\Pohoda\Type\Address;
10
11
/**
12
 * @property HeaderDto $data
13
 */
14
class Header extends AbstractAgenda
15
{
16
    use Common\AddParameterTrait;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 6
    public function setData(Common\Dtos\AbstractDto $data): parent
22
    {
23
        // process identity
24 6
        if (isset($data->identity)) {
25 6
            $identity = new Address($this->dependenciesFactory);
26 6
            $identity
27 6
                ->setDirectionalVariable($this->useOneDirectionalVariables)
28 6
                ->setResolveOptions($this->resolveOptions)
29 6
                ->setData($data->identity);
30 6
            $data->identity = $identity;
31
        }
32
33 6
        return parent::setData($data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::setData($data) returns the type kalanis\Pohoda\AbstractAgenda which is incompatible with the type-hinted return parent.
Loading history...
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 5
    public function getXML(): \SimpleXMLElement
40
    {
41 5
        $xml = $this->createXML()->addChild('adb:addressbookHeader', '', $this->namespace('adb'));
42
43 5
        $this->addElements($xml, $this->getDataElements(), 'adb');
44
45 5
        return $xml;
46
    }
47
48
    /**
49
     * @{inheritDoc}
50
     */
51 6
    protected function getDefaultDto(): Common\Dtos\AbstractDto
52
    {
53 6
        return new HeaderDto();
54
    }
55
}
56