@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | public function __construct($value = null, $unit = null) |
11 | 11 | { |
12 | - if ($value != null && $unit != null){ |
|
12 | + if ($value != null && $unit != null) { |
|
13 | 13 | $this->value($value); |
14 | 14 | $this->unit($unit); |
15 | 15 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param $value |
20 | 20 | * @return $this |
21 | 21 | */ |
22 | - public function unit($value){ |
|
22 | + public function unit($value) { |
|
23 | 23 | if ($value == "lb" || $value == "kg") |
24 | 24 | { $this->unit = $value; } |
25 | 25 | else { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param init $value |
34 | 34 | * @return $this |
35 | 35 | */ |
36 | - public function value($value){ |
|
36 | + public function value($value) { |
|
37 | 37 | $this->value = floatval($value); |
38 | 38 | return $this; |
39 | 39 | } |
@@ -21,8 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function unit($value){ |
23 | 23 | if ($value == "lb" || $value == "kg") |
24 | - { $this->unit = $value; } |
|
25 | - else { |
|
24 | + { $this->unit = $value; } else { |
|
26 | 25 | $error = "Unit must be lb or kg"; |
27 | 26 | throw new \Exception($error); |
28 | 27 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $value |
40 | 40 | * @return $this |
41 | 41 | */ |
42 | - public function contact_name($value){ |
|
42 | + public function contact_name($value) { |
|
43 | 43 | $this->contact_name = strval($value); |
44 | 44 | return $this; |
45 | 45 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $value |
49 | 49 | * @return $this |
50 | 50 | */ |
51 | - public function phone($value){ |
|
51 | + public function phone($value) { |
|
52 | 52 | $this->phone = strval($value); |
53 | 53 | return $this; |
54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param string $value |
59 | 59 | * @return $this |
60 | 60 | */ |
61 | - public function fax($value){ |
|
61 | + public function fax($value) { |
|
62 | 62 | $this->fax = strval($value); |
63 | 63 | return $this; |
64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $value |
69 | 69 | * @return $this |
70 | 70 | */ |
71 | - public function email($value){ |
|
71 | + public function email($value) { |
|
72 | 72 | $this->email = strval($value); |
73 | 73 | return $this; |
74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $value |
79 | 79 | * @return $this |
80 | 80 | */ |
81 | - public function company_name($value){ |
|
81 | + public function company_name($value) { |
|
82 | 82 | $this->company_name = strval($value); |
83 | 83 | return $this; |
84 | 84 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string $value |
88 | 88 | * @return $this |
89 | 89 | */ |
90 | - public function street1($value){ |
|
90 | + public function street1($value) { |
|
91 | 91 | $this->street1 = strval($value); |
92 | 92 | return $this; |
93 | 93 | } |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | * @param string $value |
97 | 97 | * @return $this |
98 | 98 | */ |
99 | - public function street2($value){ |
|
100 | - if(empty($value)) { |
|
99 | + public function street2($value) { |
|
100 | + if (empty($value)) { |
|
101 | 101 | $this->street2 = null; |
102 | - }else { |
|
102 | + } else { |
|
103 | 103 | $this->street2 = strval($value); |
104 | 104 | } |
105 | 105 | return $this; |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * @param string $value |
110 | 110 | * @return $this |
111 | 111 | */ |
112 | - public function street3($value){ |
|
113 | - if(empty($value)) { |
|
112 | + public function street3($value) { |
|
113 | + if (empty($value)) { |
|
114 | 114 | $this->street3 = null; |
115 | - }else { |
|
115 | + } else { |
|
116 | 116 | $this->street3 = strval($value); |
117 | 117 | } |
118 | 118 | return $this; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param string $value |
123 | 123 | * @return $this |
124 | 124 | */ |
125 | - public function city($value){ |
|
126 | - $this->city= strval($value); |
|
125 | + public function city($value) { |
|
126 | + $this->city = strval($value); |
|
127 | 127 | return $this; |
128 | 128 | } |
129 | 129 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param string $value |
132 | 132 | * @return $this |
133 | 133 | */ |
134 | - public function state($value){ |
|
134 | + public function state($value) { |
|
135 | 135 | $this->state = strval($value); |
136 | 136 | return $this; |
137 | 137 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param string $value |
141 | 141 | * @return $this |
142 | 142 | */ |
143 | - public function postal_code($value){ |
|
143 | + public function postal_code($value) { |
|
144 | 144 | $this->postal_code = strval($value); |
145 | 145 | return $this; |
146 | 146 | } |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @return $this |
151 | 151 | * @throws \Exception |
152 | 152 | */ |
153 | - public function type($value){ |
|
154 | - if($value != "residential" || $value != "business") |
|
153 | + public function type($value) { |
|
154 | + if ($value != "residential" || $value != "business") |
|
155 | 155 | { |
156 | 156 | $error = "Type must be residential or business."; |
157 | 157 | throw new \Exception($error); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param string $value |
165 | 165 | * @return $this |
166 | 166 | */ |
167 | - public function tax_id($value){ |
|
167 | + public function tax_id($value) { |
|
168 | 168 | $this->tax_id = strval($value); |
169 | 169 | return $this; |
170 | 170 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function street2($value){ |
100 | 100 | if(empty($value)) { |
101 | 101 | $this->street2 = null; |
102 | - }else { |
|
102 | + } else { |
|
103 | 103 | $this->street2 = strval($value); |
104 | 104 | } |
105 | 105 | return $this; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function street3($value){ |
113 | 113 | if(empty($value)) { |
114 | 114 | $this->street3 = null; |
115 | - }else { |
|
115 | + } else { |
|
116 | 116 | $this->street3 = strval($value); |
117 | 117 | } |
118 | 118 | return $this; |
@@ -16,8 +16,8 @@ |
||
16 | 16 | * @return $this |
17 | 17 | * @throws \Exception |
18 | 18 | */ |
19 | - public function paid_by($value){ |
|
20 | - if ($value == "shipper" || $value == "third_party" || $value == 'recipient'){ |
|
19 | + public function paid_by($value) { |
|
20 | + if ($value == "shipper" || $value == "third_party" || $value == 'recipient') { |
|
21 | 21 | $this->paid_by = $value; |
22 | 22 | } else { |
23 | 23 | $error = "Paid by must be shipper or third_party"; |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | public $amount; |
9 | 9 | public $currency; |
10 | 10 | |
11 | - public function __construct($amount=null, $currency=null) |
|
11 | + public function __construct($amount = null, $currency = null) |
|
12 | 12 | { |
13 | - if ($amount != null && $currency != null){ |
|
13 | + if ($amount != null && $currency != null) { |
|
14 | 14 | $this->amount($amount); |
15 | 15 | $this->currency($currency); |
16 | 16 | } |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @param string $value |
21 | 21 | * @return $this |
22 | 22 | */ |
23 | - public function amount($value){ |
|
23 | + public function amount($value) { |
|
24 | 24 | $this->amount = floatval($value); |
25 | 25 | return $this; |
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | - public function currency($value){ |
|
30 | - $acceptedCurrencies = ['AED','AFN','ALL','AMD','ANG','AOA','ARS','AUD','AWG','AZN','BAM','BBD','BDT','BGN','BHD', |
|
31 | - 'BIF','BMD','BND','BOB','BOV','BRL','BSD','BTN','BWP','BYR','BZD','CAD','CDF','CHE','CHF','CHW','CLF','CLP', |
|
32 | - 'CNY','COP','COU','CRC','CUC','CUP','CVE','CZK','DJF','DKK','DOP','DZD','EGP','ERN','ETB','EUR','FJD','FKP', |
|
33 | - 'GBP','GEL','GHS','GIP','GMD','GNF','GTQ','GYD','HKD','HNL','HRK','HTG','HUF','IDR','ILS','INR','IQD','IRR', |
|
34 | - 'ISK','JMD','JOD','JPY','KES','KGS','KHR','KMF','KPW','KRW','KWD','KYD','KZT','LAK','LBP','LKR','LRD','LSL', |
|
35 | - 'LTL','LVL','LYD','MAD','MDL','MGA','MKD','MMK','MNT','MOP','MRO','MUR','MVR','MWK','MXN','MXV','MYR','MZN', |
|
36 | - 'NAD','NGN','NIO','NOK','NPR','NZD','OMR','PAB','PEN','PGK','PHP','PKR','PLN','PYG','QAR','RON','RSD','RUB', |
|
37 | - 'RWF','SAR','SBD','SCR','SDG','SEK','SGD','SHP','SLL','SOS','SRD','SSP','STD','SYP','SZL','THB','TJS','TMT', |
|
38 | - 'TND','TOP','TRY','TTD','TWD','TZS','UAH','UGX','USD','USN','USS','UYI','UYU','UZS','VEF','VND','VUV','WST', |
|
39 | - 'XAF','XAG','XAU','XBA','XBB','XBC','XBD','XCD','XDR','XFU','XOF','XPD','XPF','XPT','XTS','XXX','YER','ZAR', |
|
40 | - 'ZMW']; |
|
41 | - if (in_array($value, $acceptedCurrencies)){ |
|
29 | + public function currency($value) { |
|
30 | + $acceptedCurrencies = [ 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', |
|
31 | + 'BIF', 'BMD', 'BND', 'BOB', 'BOV', 'BRL', 'BSD', 'BTN', 'BWP', 'BYR', 'BZD', 'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLF', 'CLP', |
|
32 | + 'CNY', 'COP', 'COU', 'CRC', 'CUC', 'CUP', 'CVE', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EGP', 'ERN', 'ETB', 'EUR', 'FJD', 'FKP', |
|
33 | + 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', |
|
34 | + 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', |
|
35 | + 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MXV', 'MYR', 'MZN', |
|
36 | + 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RSD', 'RUB', |
|
37 | + 'RWF', 'SAR', 'SBD', 'SCR', 'SDG', 'SEK', 'SGD', 'SHP', 'SLL', 'SOS', 'SRD', 'SSP', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', |
|
38 | + 'TND', 'TOP', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH', 'UGX', 'USD', 'USN', 'USS', 'UYI', 'UYU', 'UZS', 'VEF', 'VND', 'VUV', 'WST', |
|
39 | + 'XAF', 'XAG', 'XAU', 'XBA', 'XBB', 'XBC', 'XBD', 'XCD', 'XDR', 'XFU', 'XOF', 'XPD', 'XPF', 'XPT', 'XTS', 'XXX', 'YER', 'ZAR', |
|
40 | + 'ZMW' ]; |
|
41 | + if (in_array($value, $acceptedCurrencies)) { |
|
42 | 42 | $this->currency = $value; |
43 | - }else { |
|
43 | + } else { |
|
44 | 44 | $error = "Currency code invalid or not serviceable"; |
45 | 45 | throw new \Exception($error); |
46 | 46 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | 'ZMW']; |
41 | 41 | if (in_array($value, $acceptedCurrencies)){ |
42 | 42 | $this->currency = $value; |
43 | - }else { |
|
43 | + } else { |
|
44 | 44 | $error = "Currency code invalid or not serviceable"; |
45 | 45 | throw new \Exception($error); |
46 | 46 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * @return $this |
20 | 20 | * @throws \Exception |
21 | 21 | */ |
22 | - public function paid_by($value){ |
|
23 | - if ($value == "shipper" || $value == "third_party"){ |
|
22 | + public function paid_by($value) { |
|
23 | + if ($value == "shipper" || $value == "third_party") { |
|
24 | 24 | $this->paid_by = $value; |
25 | 25 | } else { |
26 | 26 | $error = "Paid by must be shipper or third_party"; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param PaymentMethod $value |
34 | 34 | * @return $this |
35 | 35 | */ |
36 | - public function method(PaymentMethod $value){ |
|
36 | + public function method(PaymentMethod $value) { |
|
37 | 37 | $this->method = $value; |
38 | 38 | return $this; |
39 | 39 | } |