Issues (34)

src/Pohoda/Contract.php (1 issue)

1
<?php
2
3
/**
4
 * This file is part of riesenia/pohoda package.
5
 *
6
 * Licensed under the MIT License
7
 * (c) RIESENIA.com
8
 */
9
10
declare(strict_types=1);
11
12
namespace Riesenia\Pohoda;
13
14
/**
15
 * @property array{
16
 *     header: Contract\Desc,
17
 * } $data
18
 */
19
class Contract extends AbstractAgenda
20
{
21
    use Common\AddParameterToHeaderTrait;
22
23
24 1
    public function getImportRoot(): string
25
    {
26 1
        return 'lCon:contract';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 4
    public function setData(array $data): parent
33
    {
34
        // pass to header
35 4
        $desc = new Contract\Desc($this->dependenciesFactory);
36 4
        $desc
37 4
            ->setDirectionalVariable($this->useOneDirectionalVariables)
38 4
            ->setResolveOptions($this->resolveOptions)
39 4
            ->setData($data);
40 4
        $data = ['header' => $desc];
41
42 4
        return parent::setData($data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::setData($data) returns the type Riesenia\Pohoda\AbstractAgenda which is incompatible with the type-hinted return parent.
Loading history...
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 3
    public function getXML(): \SimpleXMLElement
49
    {
50 3
        $xml = $this->createXML()->addChild('con:contract', '', $this->namespace('con'));
51 3
        $xml->addAttribute('version', '2.0');
52
53 3
        $this->addElements($xml, ['header'], 'con');
54
55 3
        return $xml;
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61 1
    protected function configureOptions(Common\OptionsResolver $resolver): void
62
    {
63
        // available options
64 1
        $resolver->setDefined(['header']);
65
    }
66
}
67