@@ 542-558 (lines=17) @@ | ||
539 | * |
|
540 | * @return $this |
|
541 | */ |
|
542 | public function addWebsiteData($websiteUrl = null, $traffic_source = null, $affiliate_id = null) |
|
543 | { |
|
544 | if ($websiteUrl !== null && !is_string($websiteUrl)) { |
|
545 | throw new \InvalidArgumentException('Website URL must be string'); |
|
546 | } |
|
547 | if ($traffic_source !== null && !is_string($traffic_source)) { |
|
548 | throw new \InvalidArgumentException('Traffic source must be string'); |
|
549 | } |
|
550 | if ($affiliate_id !== null && !is_string($affiliate_id)) { |
|
551 | throw new \InvalidArgumentException('Affiliate ID must be string'); |
|
552 | } |
|
553 | ||
554 | $this->replace('website_url', $websiteUrl); |
|
555 | $this->replace('traffic_source', $traffic_source); |
|
556 | $this->replace('affiliate_id', $affiliate_id); |
|
557 | return $this; |
|
558 | } |
|
559 | ||
560 | /** |
|
561 | * Provides IP information for envelope |
|
@@ 1028-1048 (lines=21) @@ | ||
1025 | * |
|
1026 | * @return $this |
|
1027 | */ |
|
1028 | public function addProductData( |
|
1029 | $productQuantity = null, |
|
1030 | $productName = null, |
|
1031 | $productDescription = null |
|
1032 | ) { |
|
1033 | if ($productQuantity !== null && !is_int($productQuantity) && !is_float($productQuantity)) { |
|
1034 | throw new \InvalidArgumentException('Product quantity must be int or float'); |
|
1035 | } |
|
1036 | if ($productName !== null && !is_string($productName)) { |
|
1037 | throw new \InvalidArgumentException('Product name must be string'); |
|
1038 | } |
|
1039 | if ($productDescription !== null && !is_string($productDescription)) { |
|
1040 | throw new \InvalidArgumentException('Product description must be string'); |
|
1041 | } |
|
1042 | ||
1043 | $this->replace('product_quantity', $productQuantity); |
|
1044 | $this->replace('product_name', $productName); |
|
1045 | $this->replace('product_description', $productDescription); |
|
1046 | ||
1047 | return $this; |
|
1048 | } |
|
1049 | ||
1050 | /** |
|
1051 | * Provides payout information to envelope |