Skip to content

Commit

Permalink
various new Elements in ItemOut
Browse files Browse the repository at this point in the history
  • Loading branch information
mathielen committed Jan 23, 2025
1 parent 6b8b705 commit 1e6069b
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 5 deletions.
1 change: 0 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
//this makes code unreadable
\Rector\Strict\Rector\Ternary\BooleanInTernaryOperatorRuleFixerRector::class,
\Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector::class,
\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
])
->withFileExtensions(['php'])
->withCache(
Expand Down
24 changes: 24 additions & 0 deletions src/CXml/Model/Accounting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace CXml\Model;

use JMS\Serializer\Annotation as Serializer;

readonly class Accounting
{
private function __construct(
#[Serializer\XmlAttribute]
private string $name,
/**
* @var AccountingSegment[]
*/
#[Serializer\XmlList(entry: 'AccountingSegment', inline: true)]
#[Serializer\Type('array<CXml\Model\AccountingSegment>')]
private array $accountingSegments,
#[Serializer\SerializedName('Charge')]
private MoneyWrapper $charge,
) {
}
}
22 changes: 22 additions & 0 deletions src/CXml/Model/AccountingSegment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace CXml\Model;

use JMS\Serializer\Annotation as Serializer;

readonly class AccountingSegment
{
private function __construct(
#[Serializer\XmlAttribute]
private int $id,
#[Serializer\SerializedName('Name')]
#[Serializer\XmlElement(cdata: false)]
private MultilanguageString $name,
#[Serializer\SerializedName('Description')]
#[Serializer\XmlElement(cdata: false)]
private MultilanguageString $description,
) {
}
}
16 changes: 16 additions & 0 deletions src/CXml/Model/ControlKeys.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace CXml\Model;

use JMS\Serializer\Annotation as Serializer;

readonly class ControlKeys
{
private function __construct(
#[Serializer\SerializedName('InvoiceInstruction')]
private InvoiceInstruction $invoiceInstruction,
) {
}
}
16 changes: 16 additions & 0 deletions src/CXml/Model/Distribution.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace CXml\Model;

use JMS\Serializer\Annotation as Serializer;

readonly class Distribution
{
private function __construct(
#[Serializer\SerializedName('Accounting')]
private Accounting $accounting,
) {
}
}
18 changes: 18 additions & 0 deletions src/CXml/Model/InvoiceInstruction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace CXml\Model;

use JMS\Serializer\Annotation as Serializer;

readonly class InvoiceInstruction
{
private function __construct(
#[Serializer\XmlAttribute]
private string $verificationType,
#[Serializer\XmlAttribute]
private string $value,
) {
}
}
36 changes: 32 additions & 4 deletions src/CXml/Model/ItemOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
use DateTimeInterface;
use JMS\Serializer\Annotation as Serializer;

#[Serializer\AccessorOrder(order: 'custom', custom: ['itemId', 'itemDetail'])]
readonly class ItemOut
#[Serializer\AccessorOrder(order: 'custom', custom: ['itemId', 'itemDetail', 'shipTo', 'distribution', 'controlKeys', 'scheduleLine'])]
class ItemOut
{
use CommentsTrait;

private function __construct(
#[Serializer\XmlAttribute]
#[Serializer\SerializedName('lineNumber')]
Expand All @@ -22,11 +24,17 @@ private function __construct(
#[Serializer\SerializedName('ItemDetail')]
private ItemDetail $itemDetail,
#[Serializer\XmlAttribute]
#[Serializer\SerializedName('requestedDeliveryDate')]
private ?DateTimeInterface $requestedDeliveryDate = null,
#[Serializer\XmlAttribute]
#[Serializer\SerializedName('parentLineNumber')]
private ?int $parentLineNumber = null,
#[Serializer\SerializedName('ShipTo')]
private ?ShipTo $shipTo = null,
#[Serializer\SerializedName('Distribution')]
private ?Distribution $distribution = null,
#[Serializer\SerializedName('ControlKeys')]
private ?ControlKeys $controlKeys = null,
#[Serializer\SerializedName('ScheduleLine')]
private ?ScheduleLine $scheduleLine = null,
) {
}

Expand Down Expand Up @@ -85,4 +93,24 @@ public function getParentLineNumber(): ?int
{
return $this->parentLineNumber;
}

public function getShipTo(): ?ShipTo
{
return $this->shipTo;
}

public function getDistribution(): ?Distribution
{
return $this->distribution;
}

public function getControlKeys(): ?ControlKeys
{
return $this->controlKeys;
}

public function getScheduleLine(): ?ScheduleLine
{
return $this->scheduleLine;
}
}
23 changes: 23 additions & 0 deletions src/CXml/Model/ScheduleLine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace CXml\Model;

use DateTimeInterface;
use JMS\Serializer\Annotation as Serializer;

readonly class ScheduleLine
{
private function __construct(
#[Serializer\SerializedName('UnitOfMeasure')]
private UnitOfMeasure $unitOfMeasure,
#[Serializer\XmlAttribute]
private int $quantity,
#[Serializer\XmlAttribute]
private DateTimeInterface $requestedDeliveryDate,
#[Serializer\XmlAttribute]
private ?int $lineNumber = null,
) {
}
}

0 comments on commit 1e6069b

Please sign in to comment.