@@ 750-766 (lines=17) @@ | ||
747 | * |
|
748 | * @return $this |
|
749 | */ |
|
750 | public function addWebsiteData($websiteUrl = null, $traffic_source = null, $affiliate_id = null) |
|
751 | { |
|
752 | if ($websiteUrl !== null && !is_string($websiteUrl)) { |
|
753 | throw new \InvalidArgumentException('Website URL must be string'); |
|
754 | } |
|
755 | if ($traffic_source !== null && !is_string($traffic_source)) { |
|
756 | throw new \InvalidArgumentException('Traffic source must be string'); |
|
757 | } |
|
758 | if ($affiliate_id !== null && !is_string($affiliate_id)) { |
|
759 | throw new \InvalidArgumentException('Affiliate ID must be string'); |
|
760 | } |
|
761 | ||
762 | $this->replace('website_url', $websiteUrl); |
|
763 | $this->replace('traffic_source', $traffic_source); |
|
764 | $this->replace('affiliate_id', $affiliate_id); |
|
765 | return $this; |
|
766 | } |
|
767 | ||
768 | /** |
|
769 | * Provides IP information for envelope |
|
@@ 1279-1299 (lines=21) @@ | ||
1276 | * |
|
1277 | * @return $this |
|
1278 | */ |
|
1279 | public function addProductData( |
|
1280 | $productQuantity = null, |
|
1281 | $productName = null, |
|
1282 | $productDescription = null |
|
1283 | ) { |
|
1284 | if ($productQuantity !== null && !is_int($productQuantity) && !is_float($productQuantity)) { |
|
1285 | throw new \InvalidArgumentException('Product quantity must be int or float'); |
|
1286 | } |
|
1287 | if ($productName !== null && !is_string($productName)) { |
|
1288 | throw new \InvalidArgumentException('Product name must be string'); |
|
1289 | } |
|
1290 | if ($productDescription !== null && !is_string($productDescription)) { |
|
1291 | throw new \InvalidArgumentException('Product description must be string'); |
|
1292 | } |
|
1293 | ||
1294 | $this->replace('product_quantity', $productQuantity); |
|
1295 | $this->replace('product_name', $productName); |
|
1296 | $this->replace('product_description', $productDescription); |
|
1297 | ||
1298 | return $this; |
|
1299 | } |
|
1300 | ||
1301 | /** |
|
1302 | * Provides payout information to envelope |