Issues (38)

src/Pohoda/StockTransfer/Item.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace kalanis\Pohoda\StockTransfer;
6
7
use kalanis\Pohoda\AbstractAgenda;
8
use kalanis\Pohoda\Common;
9
use kalanis\Pohoda\Type\StockItem;
10
11
/**
12
 * @property ItemDto $data
13
 */
14
class Item extends AbstractAgenda
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19 1
    public function setData(Common\Dtos\AbstractDto $data): parent
20
    {
21
        // process stock item
22 1
        if (isset($data->stockItem)) {
23 1
            $stockItem = new StockItem($this->dependenciesFactory);
24 1
            $stockItem
25 1
                ->setDirectionalVariable($this->useOneDirectionalVariables)
26 1
                ->setResolveOptions($this->resolveOptions)
27 1
                ->setData($data->stockItem);
28 1
            $data->stockItem = $stockItem;
29
        }
30
31 1
        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...
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 1
    public function getXML(): \SimpleXMLElement
38
    {
39 1
        $xml = $this->createXML()->addChild('pre:prevodkaItem', '', $this->namespace('pre'));
40
41 1
        $this->addElements($xml, $this->getDataElements(), 'pre');
42
43 1
        return $xml;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 1
    protected function getDefaultDto(): Common\Dtos\AbstractDto
50
    {
51 1
        return new ItemDto();
52
    }
53
}
54