Skip to content

add UserCreatedForm entity and add it as a new attribute in Internati… #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/Entity/InternationalForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ class InternationalForms implements NodeInterface
*/
private $eeiFilingOption;

/**
* @var UserCreatedForm
*/
private $userCreatedForm;

/**
* @return array
*/
Expand Down Expand Up @@ -295,6 +300,26 @@ public function getProducts()
return $this->products;
}

/**
* @param $userCreatedForm UserCreatedForm
*
* @return $this
*/
public function setUserCreatedForm(UserCreatedForm $userCreatedForm)
{
$this->userCreatedForm = $userCreatedForm;

return $this;
}

/**
* @return UserCreatedForm
*/
public function getUserCreatedForm()
{
return $this->userCreatedForm;
}

/**
* @param null|DOMDocument $document
*
Expand Down Expand Up @@ -347,6 +372,10 @@ public function toNode(DOMDocument $document = null)
if ($this->getEEIFilingOption() !== null) {
$node->appendChild($this->getEEIFilingOption()->toNode($document));
}
if ($this->getUserCreatedForm() !== null) {
$node->appendChild($this->getUserCreatedForm()->toNode($document));
}

foreach ($this->products as $product) {
$node->appendChild($product->toNode($document));
}
Expand Down
67 changes: 67 additions & 0 deletions src/Entity/UserCreatedForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Ups\Entity;

use DOMDocument;
use DOMElement;
use Ups\NodeInterface;

/**
* Class Unit.
*/
class UserCreatedForm implements NodeInterface
{

/**
* @var string
*/
private $documentID;
/**
* @param null|object $attributes
*/
public function __construct($attributes = null)
{
if (null !== $attributes) {
if (isset($attributes->DocumentID)) {
$this->setDocumentID($attributes->DocumentID);
}
}
}

/**
* @param null|DOMDocument $document
*
* @return DOMElement
*/
public function toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}

$node = $document->createElement('UserCreatedForm');
$node->appendChild($document->createElement('DocumentID', $this->getDocumentID()));

return $node;
}

/**
* @return string
*/
public function getDocumentID()
{
return $this->documentID;
}

/**
* @param string $number
*
* @return $this
*/
public function setDocumentID($documentID)
{
$this->documentID = $documentID;

return $this;
}
}