From 27fafba5771a09898d73fde7da29484e2413feeb Mon Sep 17 00:00:00 2001 From: Sergey Nechaev Date: Tue, 21 Apr 2015 13:32:01 +0500 Subject: [PATCH 1/2] Dimensions are not required in Rate API --- src/Ups/Entity/Package.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Ups/Entity/Package.php b/src/Ups/Entity/Package.php index 6be45f24..a900868b 100644 --- a/src/Ups/Entity/Package.php +++ b/src/Ups/Entity/Package.php @@ -73,7 +73,7 @@ class Package implements NodeInterface private $largePackage; /** - * @var Dimensions + * @var Dimensions|null */ private $dimensions; @@ -89,7 +89,6 @@ public function __construct($attributes = null) { $this->setPackagingType(new PackagingType); $this->setReferenceNumber(new ReferenceNumber); - $this->setDimensions(new Dimensions); $this->setPackageWeight(new PackageWeight); $this->setPackageServiceOptions(new PackageServiceOptions); @@ -146,7 +145,9 @@ public function toNode(DOMDocument $document = null) $node->appendChild($this->getPackagingType()->toNode($document)); $node->appendChild($this->getPackageWeight()->toNode($document)); - $node->appendChild($this->getDimensions()->toNode($document)); + if (null !== $this->getDimensions()) { + $node->appendChild($this->getDimensions()->toNode($document)); + } $node->appendChild($this->getPackageServiceOptions()->toNode($document)); return $node; } From b29bc7a2d3af3d26ce69eaf66bfd0a59c89f769e Mon Sep 17 00:00:00 2001 From: Sergey Nechaev Date: Tue, 21 Apr 2015 13:34:52 +0500 Subject: [PATCH 2/2] Added null to getDimensions return types --- src/Ups/Entity/Package.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ups/Entity/Package.php b/src/Ups/Entity/Package.php index a900868b..e7fcbccd 100644 --- a/src/Ups/Entity/Package.php +++ b/src/Ups/Entity/Package.php @@ -191,7 +191,7 @@ public function setDescription($description) } /** - * @return Dimensions + * @return Dimensions|null */ public function getDimensions() {