@@ 979-995 (lines=17) @@ | ||
976 | * |
|
977 | * @return $this |
|
978 | */ |
|
979 | public function addWebsiteData($websiteUrl = null, $traffic_source = null, $affiliate_id = null) |
|
980 | { |
|
981 | if ($websiteUrl !== null && !is_string($websiteUrl)) { |
|
982 | throw new \InvalidArgumentException('Website URL must be string'); |
|
983 | } |
|
984 | if ($traffic_source !== null && !is_string($traffic_source)) { |
|
985 | throw new \InvalidArgumentException('Traffic source must be string'); |
|
986 | } |
|
987 | if ($affiliate_id !== null && !is_string($affiliate_id)) { |
|
988 | throw new \InvalidArgumentException('Affiliate ID must be string'); |
|
989 | } |
|
990 | ||
991 | $this->replace('website_url', $websiteUrl); |
|
992 | $this->replace('traffic_source', $traffic_source); |
|
993 | $this->replace('affiliate_id', $affiliate_id); |
|
994 | return $this; |
|
995 | } |
|
996 | ||
997 | /** |
|
998 | * Provides IP information for envelope |
|
@@ 1543-1563 (lines=21) @@ | ||
1540 | * |
|
1541 | * @return $this |
|
1542 | */ |
|
1543 | public function addProductData( |
|
1544 | $productQuantity = null, |
|
1545 | $productName = null, |
|
1546 | $productDescription = null |
|
1547 | ) { |
|
1548 | if ($productQuantity !== null && !is_int($productQuantity) && !is_float($productQuantity)) { |
|
1549 | throw new \InvalidArgumentException('Product quantity must be int or float'); |
|
1550 | } |
|
1551 | if ($productName !== null && !is_string($productName)) { |
|
1552 | throw new \InvalidArgumentException('Product name must be string'); |
|
1553 | } |
|
1554 | if ($productDescription !== null && !is_string($productDescription)) { |
|
1555 | throw new \InvalidArgumentException('Product description must be string'); |
|
1556 | } |
|
1557 | ||
1558 | $this->replace('product_quantity', $productQuantity); |
|
1559 | $this->replace('product_name', $productName); |
|
1560 | $this->replace('product_description', $productDescription); |
|
1561 | ||
1562 | return $this; |
|
1563 | } |
|
1564 | ||
1565 | /** |
|
1566 | * Provides payout information to envelope |