'UPS Next Day Air', '02' => 'UPS Second Day Air', '03' => 'UPS Ground', '07' => 'UPS Worldwide Express', '08' => 'UPS Worldwide Expedited', '11' => 'UPS Standard', '12' => 'UPS Three-Day Select', '13' => 'Next Day Air Saver', '14' => 'UPS Next Day Air Early AM', '54' => 'UPS Worldwide Express Plus', '59' => 'UPS Second Day Air AM', '65' => 'UPS Saver', '70' => 'UPS Access Point Economy' ]; /** @deprecated */ public $Description; /** * @var string */ private $code = self::S_GROUND; /** * @var string */ private $description; /** * @param null|object $attributes */ public function __construct($attributes = null) { if (null !== $attributes) { if (isset($attributes->Code)) { $this->setCode($attributes->Code); } if (isset($attributes->Description)) { $this->setDescription($attributes->Description); } } } /** * @return array */ public static function getServices() { return self::$serviceNames; } /** * @param null|DOMDocument $document * * @return DOMElement */ public function toNode(DOMDocument $document = null) { if (null === $document) { $document = new DOMDocument(); } $node = $document->createElement('Service'); $node->appendChild($document->createElement('Code', $this->getCode())); $node->appendChild($document->createElement('Description', $this->getDescription())); return $node; } /** * @return string */ public function getName() { return self::$serviceNames[$this->getCode()]; } /** * @return string */ public function getCode() { return $this->code; } /** * @param string $code * * @return $this */ public function setCode($code) { $this->code = $code; return $this; } /** * @return string */ public function getDescription() { return $this->description; } /** * @param string $description * * @return $this */ public function setDescription($description) { $this->Description = $description; $this->description = $description; return $this; } }