-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathAdditionalItemProperty.php
More file actions
89 lines (78 loc) · 2.01 KB
/
Copy pathAdditionalItemProperty.php
File metadata and controls
89 lines (78 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
namespace NumNum\UBL;
use Sabre\Xml\Reader;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlDeserializable;
use Sabre\Xml\XmlSerializable;
use function Sabre\Xml\Deserializer\keyValue;
/**
* Additional Item Property
* A group of business terms providing information about properties of the goods and services invoiced.
*
* @see https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-InvoiceLine/cac-Item/cac-AdditionalItemProperty/
*/
class AdditionalItemProperty implements XmlSerializable, XmlDeserializable
{
private ?string $name = null;
private ?string $value = null;
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string|null $name
* @return static
*/
public function setName(?string $name)
{
$this->name = $name;
return $this;
}
/**
* @return string|null
*/
public function getValue(): ?string
{
return $this->value;
}
/**
* @param string|null $value
* @return static
*/
public function setValue(?string $value)
{
$this->value = $value;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->name !== null) {
$writer->write([Schema::CBC . 'Name' => $this->name]);
}
if ($this->value !== null) {
$writer->write([Schema::CBC . 'Value' => $this->value]);
}
}
/**
* The xmlDeserialize method is called during xml reading.
*
* @param Reader $reader
* @return static
*/
public static function xmlDeserialize(Reader $reader)
{
$mixedContent = keyValue($reader);
return (new static())
->setName($mixedContent[Schema::CBC . 'Name'] ?? null)
->setValue($mixedContent[Schema::CBC . 'Value'] ?? null);
}
}