public function __construct(uspsShipping $plugin, array $params) { // tracking ID is obligatory if (!isset($params['tracking_id'])) { throw new waException($plugin->_w("Empty tracking ID")); } parent::__construct($plugin, $params); }
public function __construct(uspsShipping $plugin, array $params) { $service = uspsServices::getServiceByCode(!empty($params['service']) ? $params['service'] : ''); if (!$service) { throw new waException($plugin->_w("Unknown service")); } $supported = $this->getSupportedServices(); if (is_array($supported) && !in_array($service['code'], $supported)) { throw new waException($plugin->_w("Unsupported service: ") . $service['code'] . $plugin->_w(". Supported services by this API are: ") . implode(", ", $supported)); } $this->service = $service; parent::__construct($plugin, $params); }
public function __construct(uspsShipping $plugin, array $params) { parent::__construct($plugin, $params); }