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 array $data |
||
67 | */ |
||
68 | 8 | public function __construct( |
|
82 | |||
83 | /** |
||
84 | * Collect and get rates for storefront |
||
85 | * |
||
86 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
87 | * @param RateRequest $request |
||
88 | * @return DataObject|bool|null |
||
89 | * @api |
||
90 | */ |
||
91 | 6 | public function collectRates(RateRequest $request) |
|
146 | |||
147 | |||
148 | /** |
||
149 | * Gets the methods selected in the admin area of the extension |
||
150 | * to ensure that not allowed methods can be removed in the collect |
||
151 | * rates method |
||
152 | * |
||
153 | * @return array |
||
154 | */ |
||
155 | 6 | public function getAllowedMethods() |
|
162 | /** |
||
163 | * Gets the clean method names from the royal mail library data |
||
164 | * class. These names link directly to method names, but are used |
||
165 | * to ensure that duplicates are not created as similar names |
||
166 | * exists for multiple methods. |
||
167 | * |
||
168 | * @return array |
||
169 | */ |
||
170 | 7 | public function getMethods() |
|
174 | |||
175 | /** |
||
176 | * @return LibCarrier |
||
177 | */ |
||
178 | 7 | public function getCarrier() |
|
196 | |||
197 | /** |
||
198 | * @deprecated |
||
199 | * @param $libCarrier |
||
200 | * @return $this |
||
201 | */ |
||
202 | 8 | public function setCarrier($libCarrier) |
|
207 | |||
208 | /** |
||
209 | * Get package weight in Kilograms converting from lbs if necessary. |
||
210 | * |
||
211 | * @param $weight |
||
212 | * @param $unit |
||
213 | * @return mixed |
||
214 | */ |
||
215 | 5 | protected function getPackageWeightInKg($weight, $unit) |
|
223 | |||
224 | /** |
||
225 | * Both small and medium sized parcels can serve up to 2KG. |
||
226 | * Configuration option determines which size we show to customer. |
||
227 | * |
||
228 | * @param \Meanbee\RoyalMail\Method[] $methods |
||
229 | * @param int $weight |
||
230 | * @return \Meanbee\RoyalMail\Method[] |
||
231 | */ |
||
232 | 5 | protected function removeUnusedParcelSizes($methods, $weight) |
|
245 | } |
||
246 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.