container['product_id'] = isset($data['product_id']) ? $data['product_id'] : null;; $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; $this->container['price'] = isset($data['price']) ? $data['price'] : null; $this->container['title'] = isset($data['title']) ? $data['title'] : null; $this->container['tax'] = isset($data['tax']) ? $data['tax'] : null;; $this->container['external_content_id'] = isset($data['external_content_id']) ? $data['external_content_id'] : null; } /** * Get Product Id. * @return string Product Id */ public function getProductId() { return $this->container['product_id']; } /** * Sets product id. * @param string $product_id product id * @return $this */ public function setProductId($product_id) { $this->container['product_id'] = $product_id; return $this; } /** * Get number of product. * @return integer quantity */ public function getQuantity() { return $this->container['quantity']; } /** * Set number of product. * @param integer $quantity number of items * @return $this */ public function setQuantity($quantity) { $this->container['quantity'] = $quantity; return $this; } /** * Get total price. * @return float Price */ public function getPrice() { return $this->container['price']; } /** * Set total price. * @param float Price * @return $this */ public function setPrice($price) { $this->container['price'] = $price; return $this; } /** * Get title. * @return string title */ public function getTitle() { return $this->container['title']; } /** * Sets title. * @param string $title title * @return $this */ public function setTitle($title) { $this->container['title'] = $title; return $this; } /** * Gets the string presentation of the object * @return string */ public function __toString() { if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print return json_encode($this, JSON_PRETTY_PRINT); } return json_encode($this); } /** * convert to Json * @return array */ public function toJson() { $request = array( 'id' => $this->container['product_id'], 'quantity' => $this->container['quantity'], 'price' => $this->container['price'], 'title' => $this->container['title'], 'tax' => $this->container['tax'], 'external_content_id' => $this->container['external_content_id'], ); $request = array_filter($request); return $request; } }