1 | <?php |
||
23 | class Carrier extends AbstractCarrier implements CarrierInterface |
||
24 | { |
||
25 | /** |
||
26 | * Carrier's code |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $_code = 'meanbee_royalmail'; |
||
31 | |||
32 | /** |
||
33 | * Whether this carrier has fixed rates calculation |
||
34 | * |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $_isFixed = true; |
||
38 | |||
39 | /** |
||
40 | * @var ResultFactory |
||
41 | */ |
||
42 | protected $rateResultFactory; |
||
43 | |||
44 | /** |
||
45 | * @var MethodFactory |
||
46 | */ |
||
47 | protected $rateMethodFactory; |
||
48 | |||
49 | /** |
||
50 | * @var LibCarrier |
||
51 | */ |
||
52 | protected $carrier; |
||
53 | |||
54 | /** |
||
55 | * @var Rounder |
||
56 | */ |
||
57 | protected $rounder; |
||
58 | |||
59 | /** |
||
60 | * @param ScopeConfigInterface $scopeConfig |
||
61 | * @param ErrorFactory $rateErrorFactory |
||
62 | * @param LoggerInterface $logger |
||
63 | * @param ResultFactory $rateResultFactory |
||
64 | * @param MethodFactory $rateMethodFactory |
||
65 | * @param Rounder $rounder |
||
66 | * @param LibCarrier $carrier |
||
67 | * @param array $data |
||
68 | */ |
||
69 | 8 | public function __construct( |
|
84 | |||
85 | /** |
||
86 | * Collect and get rates for storefront |
||
87 | * |
||
88 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
89 | * @param RateRequest $request |
||
90 | * @return DataObject|bool|null |
||
91 | * @api |
||
92 | */ |
||
93 | 6 | public function collectRates(RateRequest $request) |
|
148 | |||
149 | |||
150 | /** |
||
151 | * Gets the methods selected in the admin area of the extension |
||
152 | * to ensure that not allowed methods can be removed in the collect |
||
153 | * rates method |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | 6 | public function getAllowedMethods() |
|
164 | /** |
||
165 | * Gets the clean method names from the royal mail library data |
||
166 | * class. These names link directly to method names, but are used |
||
167 | * to ensure that duplicates are not created as similar names |
||
168 | * exists for multiple methods. |
||
169 | * |
||
170 | * @return array |
||
171 | */ |
||
172 | 7 | public function getMethods() |
|
176 | |||
177 | /** |
||
178 | * @return LibCarrier |
||
179 | */ |
||
180 | 7 | public function getCarrier() |
|
198 | |||
199 | /** |
||
200 | * @deprecated |
||
201 | * @param $libCarrier |
||
202 | * @return $this |
||
203 | */ |
||
204 | 8 | public function setCarrier($libCarrier) |
|
209 | |||
210 | /** |
||
211 | * Get package weight in Kilograms converting from lbs if necessary. |
||
212 | * |
||
213 | * @param $weight |
||
214 | * @param $unit |
||
215 | * @return mixed |
||
216 | */ |
||
217 | 5 | protected function getPackageWeightInKg($weight, $unit) |
|
225 | |||
226 | /** |
||
227 | * Both small and medium sized parcels can serve up to 2KG. |
||
228 | * Configuration option determines which size we show to customer. |
||
229 | * |
||
230 | * @param \Meanbee\RoyalMail\Method[] $methods |
||
231 | * @param int $weight |
||
232 | * @return \Meanbee\RoyalMail\Method[] |
||
233 | */ |
||
234 | 5 | protected function removeUnusedParcelSizes($methods, $weight) |
|
247 | } |
||
248 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.