@@ -26,6 +26,10 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | + /** |
|
30 | + * @param Label $data |
|
31 | + * @param string $endpoint |
|
32 | + */ |
|
29 | 33 | private function sendRequest($data, $endpoint){ |
30 | 34 | $method = 'POST'; |
31 | 35 | $headers = array( |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | - private function sendRequest($data, $endpoint){ |
|
29 | + private function sendRequest($data, $endpoint) { |
|
30 | 30 | $method = 'POST'; |
31 | 31 | $headers = array( |
32 | 32 | "content-type: application/json", |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | curl_close($curl); |
51 | 51 | |
52 | 52 | if ($err) { |
53 | - echo "cURL Error #:" . $err; |
|
53 | + echo "cURL Error #:".$err; |
|
54 | 54 | } else { |
55 | 55 | return $response; |
56 | 56 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param string $size |
38 | 38 | * @return $this |
39 | 39 | */ |
40 | - public function paper_size($size="default") |
|
40 | + public function paper_size($size = "default") |
|
41 | 41 | { |
42 | 42 | $this->paper_size = $size; |
43 | 43 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param bool $value |
58 | 58 | * @return $this |
59 | 59 | */ |
60 | - public function is_document($value=true) |
|
60 | + public function is_document($value = true) |
|
61 | 61 | { |
62 | 62 | if ($value == true) { |
63 | 63 | $$this->is_document = true; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param bool $value |
108 | 108 | * @return $this |
109 | 109 | */ |
110 | - public function return_shipment($value=true) |
|
110 | + public function return_shipment($value = true) |
|
111 | 111 | { |
112 | 112 | if ($value == true) { |
113 | 113 | $$this->return_shipment = true; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function COD(Money $money) |
135 | 135 | { |
136 | - if ($this->service_options == null){ |
|
136 | + if ($this->service_options == null) { |
|
137 | 137 | $this->service_options = array(); |
138 | 138 | } |
139 | 139 | $option = new \stdClass(); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param Invoice $invoice |
148 | 148 | * @return $this |
149 | 149 | */ |
150 | - public function invoice(Invoice $invoice){ |
|
150 | + public function invoice(Invoice $invoice) { |
|
151 | 151 | $this->invoice = $invoice; |
152 | 152 | return $this; |
153 | 153 | } |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | * @param array $references |
157 | 157 | * @return $this |
158 | 158 | */ |
159 | - public function references(array $references){ |
|
159 | + public function references(array $references) { |
|
160 | 160 | $this->references = $references; |
161 | 161 | return $this; |
162 | 162 | } |
163 | 163 | |
164 | - public function billing(Billing $billing){ |
|
164 | + public function billing(Billing $billing) { |
|
165 | 165 | $this->billing = $billing; |
166 | 166 | return $this; |
167 | 167 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param Customs $customs |
171 | 171 | * @return $this |
172 | 172 | */ |
173 | - public function customs(Customs $customs){ |
|
173 | + public function customs(Customs $customs) { |
|
174 | 174 | $this->customs = $customs; |
175 | 175 | return $this; |
176 | 176 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param string $value |
20 | 20 | * @return $this |
21 | 21 | */ |
22 | - public function number($value){ |
|
22 | + public function number($value) { |
|
23 | 23 | $this->number = strval($value); |
24 | 24 | return $this; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param string $value |
29 | 29 | * @return $this |
30 | 30 | */ |
31 | - public function type($value){ |
|
31 | + public function type($value) { |
|
32 | 32 | $this->type = strval($value); |
33 | 33 | return $this; |
34 | 34 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return $this |
39 | 39 | * @throws \Exception |
40 | 40 | */ |
41 | - public function number_of_copies($value){ |
|
42 | - if ($value >= 1 && $value <= 4 ) |
|
41 | + public function number_of_copies($value) { |
|
42 | + if ($value >= 1 && $value <= 4) |
|
43 | 43 | {$this->number_of_copies = $value; } |
44 | 44 | else { |
45 | 45 | $error = "Number of copies must be between 1 and 4"; |
@@ -40,8 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function number_of_copies($value){ |
42 | 42 | if ($value >= 1 && $value <= 4 ) |
43 | - {$this->number_of_copies = $value; } |
|
44 | - else { |
|
43 | + {$this->number_of_copies = $value; } else { |
|
45 | 44 | $error = "Number of copies must be between 1 and 4"; |
46 | 45 | throw new \Exception($error); |
47 | 46 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @param string $value |
14 | 14 | * @return $this |
15 | 15 | */ |
16 | - public function account_number($value){ |
|
16 | + public function account_number($value) { |
|
17 | 17 | $this->account_number = strval($value); |
18 | 18 | return $this; |
19 | 19 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param string $value |
23 | 23 | * @return $this |
24 | 24 | */ |
25 | - public function postal_code($value){ |
|
25 | + public function postal_code($value) { |
|
26 | 26 | $this->postal_code = strval($value); |
27 | 27 | return $this; |
28 | 28 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @return $this |
16 | 16 | */ |
17 | 17 | public function box_type($value) { |
18 | - $this->box_type = strval($value);; |
|
18 | + $this->box_type = strval($value); ; |
|
19 | 19 | return $this; |
20 | 20 | } |
21 | 21 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param Dimension $dimension |
24 | 24 | * @return $this |
25 | 25 | */ |
26 | - public function dimension(Dimension $dimension){ |
|
26 | + public function dimension(Dimension $dimension) { |
|
27 | 27 | $this->dimension = $dimension; |
28 | 28 | return $this; |
29 | 29 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param $value |
42 | 42 | * @return $this |
43 | 43 | */ |
44 | - public function description($value){ |
|
44 | + public function description($value) { |
|
45 | 45 | $this->description = strval($value); |
46 | 46 | return $this; |
47 | 47 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param Weight $weight |
51 | 51 | * @return $this |
52 | 52 | */ |
53 | - public function weight(Weight $weight){ |
|
53 | + public function weight(Weight $weight) { |
|
54 | 54 | $this->weight = $weight; |
55 | 55 | return $this; |
56 | 56 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | * @return $this |
18 | 18 | * @throws \Exception |
19 | 19 | */ |
20 | - public function purpose($value){ |
|
20 | + public function purpose($value) { |
|
21 | 21 | $purposes = array('gift', 'merchandise', 'sample', 'return', 'repair'); |
22 | - if(in_array($value, $purposes)){ |
|
22 | + if (in_array($value, $purposes)) { |
|
23 | 23 | $this->purpose = $value; |
24 | 24 | } else { |
25 | 25 | $error = "Purpose must be gift, merchandise, sample, return, or repair"; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @return $this |
34 | 34 | * @throws \Exception |
35 | 35 | */ |
36 | - public function terms_of_trade($value){ |
|
37 | - $terms = array('dat','ddu','ddp','dap'); |
|
38 | - if(in_array($value, $terms)){ |
|
36 | + public function terms_of_trade($value) { |
|
37 | + $terms = array('dat', 'ddu', 'ddp', 'dap'); |
|
38 | + if (in_array($value, $terms)) { |
|
39 | 39 | $this->terms_of_trade = $value; |
40 | 40 | } else { |
41 | 41 | $error = "Terms must be dat, ddu, ddp, or dap"; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param no_eei $value |
49 | 49 | * @return $this |
50 | 50 | */ |
51 | - public function no_eei(no_eei $value){ |
|
51 | + public function no_eei(no_eei $value) { |
|
52 | 52 | $this->eei = $value; |
53 | 53 | return $this; |
54 | 54 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param aes $value |
58 | 58 | * @return $this |
59 | 59 | */ |
60 | - public function aes(aes $value){ |
|
60 | + public function aes(aes $value) { |
|
61 | 61 | $this->eei = $value; |
62 | 62 | return $this; |
63 | 63 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param CustomsBilling $value |
67 | 67 | * @return $this |
68 | 68 | */ |
69 | - public function customs_billing(CustomsBilling $value){ |
|
69 | + public function customs_billing(CustomsBilling $value) { |
|
70 | 70 | $this->billing = $value; |
71 | 71 | return $this; |
72 | 72 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param Address $value |
76 | 76 | * @return $this |
77 | 77 | */ |
78 | - public function importer_address(Address $value){ |
|
78 | + public function importer_address(Address $value) { |
|
79 | 79 | $this->importer_address = $value; |
80 | 80 | return $this; |
81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param Passport $value |
85 | 85 | * @return $this |
86 | 86 | */ |
87 | - public function passport(Passport $value){ |
|
87 | + public function passport(Passport $value) { |
|
88 | 88 | $this->passport = $value; |
89 | 89 | return $this; |
90 | 90 | } |
@@ -4,19 +4,19 @@ |
||
4 | 4 | |
5 | 5 | class Model |
6 | 6 | { |
7 | - protected $acceptedCountries = array('ABW','AFG','AGO','AIA','ALA','ALB','AND','ARE','ARG','ARM','ASM','ATA','ATF','ATG','AUS', |
|
8 | - 'AUT','AZE','BDI','BEL','BEN','BES','BFA','BGD','BGR','BHR','BHS','BIH','BLM','BLR','BLZ','BMU','BOL','BRA', |
|
9 | - 'BRB','BRN','BTN','BVT','BWA','CAF','CAN','CCK','CHE','CHL','CHN','CIV','CMR','COD','COG','COK','COL','COM', |
|
10 | - 'CPV','CRI','CUB','CUW','CXR','CYM','CYP','CZE','DEU','DJI','DMA','DNK','DOM','DZA','ECU','EGY','ERI','ESH', |
|
11 | - 'ESP','EST','ETH','FIN','FJI','FLK','FRA','FRO','FSM','GAB','GBR','GEO','GGY','GHA','GIB','GIN','GLP','GMB', |
|
12 | - 'GNB','GNQ','GRC','GRD','GRL','GTM','GUF','GUM','GUY','HKG','HMD','HND','HRV','HTI','HUN','IDN','IMN','IND', |
|
13 | - 'IOT','IRL','IRN','IRQ','ISL','ISR','ITA','JAM','JEY','JOR','JPN','KAZ','KEN','KGZ','KHM','KIR','KNA','KOR', |
|
14 | - 'KWT','LAO','LBN','LBR','LBY','LCA','LIE','LKA','LSO','LTU','LUX','LVA','MAC','MAF','MAR','MCO','MDA','MDG', |
|
15 | - 'MDV','MEX','MHL','MKD','MLI','MLT','MMR','MNE','MNG','MNP','MOZ','MRT','MSR','MTQ','MUS','MWI','MYS','MYT', |
|
16 | - 'NAM','NCL','NER','NFK','NGA','NIC','NIU','NLD','NOR','NPL','NRU','NZL','OMN','PAK','PAN','PCN','PER','PHL', |
|
17 | - 'PLW','PNG','POL','PRI','PRK','PRT','PRY','PSE','PYF','QAT','REU','ROU','RUS','RWA','SAU','SDN','SEN','SGP', |
|
18 | - 'SGS','SHN','SJM','SLB','SLE','SLV','SMR','SOM','SPM','SRB','SSD','STP','SUR','SVK','SVN','SWE','SWZ','SXM', |
|
19 | - 'SYC','SYR','TCA','TCD','TGO','THA','TJK','TKL','TKM','TLS','TON','TTO','TUN','TUR','TUV','TWN','TZA','UGA', |
|
20 | - 'UKR','UMI','URY','USA','UZB','VAT','VCT','VEN','VGB','VIR','VNM','VUT','WLF','WSM','YEM','ZAF','ZMB','ZWE'); |
|
7 | + protected $acceptedCountries = array('ABW', 'AFG', 'AGO', 'AIA', 'ALA', 'ALB', 'AND', 'ARE', 'ARG', 'ARM', 'ASM', 'ATA', 'ATF', 'ATG', 'AUS', |
|
8 | + 'AUT', 'AZE', 'BDI', 'BEL', 'BEN', 'BES', 'BFA', 'BGD', 'BGR', 'BHR', 'BHS', 'BIH', 'BLM', 'BLR', 'BLZ', 'BMU', 'BOL', 'BRA', |
|
9 | + 'BRB', 'BRN', 'BTN', 'BVT', 'BWA', 'CAF', 'CAN', 'CCK', 'CHE', 'CHL', 'CHN', 'CIV', 'CMR', 'COD', 'COG', 'COK', 'COL', 'COM', |
|
10 | + 'CPV', 'CRI', 'CUB', 'CUW', 'CXR', 'CYM', 'CYP', 'CZE', 'DEU', 'DJI', 'DMA', 'DNK', 'DOM', 'DZA', 'ECU', 'EGY', 'ERI', 'ESH', |
|
11 | + 'ESP', 'EST', 'ETH', 'FIN', 'FJI', 'FLK', 'FRA', 'FRO', 'FSM', 'GAB', 'GBR', 'GEO', 'GGY', 'GHA', 'GIB', 'GIN', 'GLP', 'GMB', |
|
12 | + 'GNB', 'GNQ', 'GRC', 'GRD', 'GRL', 'GTM', 'GUF', 'GUM', 'GUY', 'HKG', 'HMD', 'HND', 'HRV', 'HTI', 'HUN', 'IDN', 'IMN', 'IND', |
|
13 | + 'IOT', 'IRL', 'IRN', 'IRQ', 'ISL', 'ISR', 'ITA', 'JAM', 'JEY', 'JOR', 'JPN', 'KAZ', 'KEN', 'KGZ', 'KHM', 'KIR', 'KNA', 'KOR', |
|
14 | + 'KWT', 'LAO', 'LBN', 'LBR', 'LBY', 'LCA', 'LIE', 'LKA', 'LSO', 'LTU', 'LUX', 'LVA', 'MAC', 'MAF', 'MAR', 'MCO', 'MDA', 'MDG', |
|
15 | + 'MDV', 'MEX', 'MHL', 'MKD', 'MLI', 'MLT', 'MMR', 'MNE', 'MNG', 'MNP', 'MOZ', 'MRT', 'MSR', 'MTQ', 'MUS', 'MWI', 'MYS', 'MYT', |
|
16 | + 'NAM', 'NCL', 'NER', 'NFK', 'NGA', 'NIC', 'NIU', 'NLD', 'NOR', 'NPL', 'NRU', 'NZL', 'OMN', 'PAK', 'PAN', 'PCN', 'PER', 'PHL', |
|
17 | + 'PLW', 'PNG', 'POL', 'PRI', 'PRK', 'PRT', 'PRY', 'PSE', 'PYF', 'QAT', 'REU', 'ROU', 'RUS', 'RWA', 'SAU', 'SDN', 'SEN', 'SGP', |
|
18 | + 'SGS', 'SHN', 'SJM', 'SLB', 'SLE', 'SLV', 'SMR', 'SOM', 'SPM', 'SRB', 'SSD', 'STP', 'SUR', 'SVK', 'SVN', 'SWE', 'SWZ', 'SXM', |
|
19 | + 'SYC', 'SYR', 'TCA', 'TCD', 'TGO', 'THA', 'TJK', 'TKL', 'TKM', 'TLS', 'TON', 'TTO', 'TUN', 'TUR', 'TUV', 'TWN', 'TZA', 'UGA', |
|
20 | + 'UKR', 'UMI', 'URY', 'USA', 'UZB', 'VAT', 'VCT', 'VEN', 'VGB', 'VIR', 'VNM', 'VUT', 'WLF', 'WSM', 'YEM', 'ZAF', 'ZMB', 'ZWE'); |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param string $value |
12 | 12 | * @return $this |
13 | 13 | */ |
14 | - public function number($value){ |
|
14 | + public function number($value) { |
|
15 | 15 | $this->number = strval($value); |
16 | 16 | return $this; |
17 | 17 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param string $value |
21 | 21 | * @return $this |
22 | 22 | */ |
23 | - public function issue_date($value){ |
|
23 | + public function issue_date($value) { |
|
24 | 24 | $this->issue_date = strval($value); |
25 | 25 | return $this; |
26 | 26 | } |
@@ -11,9 +11,9 @@ |
||
11 | 11 | public $unit; |
12 | 12 | |
13 | 13 | |
14 | - public function __construct($width=null, $height=null, $depth=null, $unit=null) |
|
14 | + public function __construct($width = null, $height = null, $depth = null, $unit = null) |
|
15 | 15 | { |
16 | - if ($width != null && $height != null && $depth != null && $unit != null){ |
|
16 | + if ($width != null && $height != null && $depth != null && $unit != null) { |
|
17 | 17 | $this->width($width); |
18 | 18 | $this->height($height); |
19 | 19 | $this->depth($depth); |
@@ -55,8 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function unit($value) { |
57 | 57 | if ($value == "in" || $value = "cm") |
58 | - {$this->unit = $value; } |
|
59 | - else { |
|
58 | + {$this->unit = $value; } else { |
|
60 | 59 | $error = "Unit must be in or cm"; |
61 | 60 | throw new \Exception($error); |
62 | 61 | } |