You are here

public function USPSBase::__construct in Commerce USPS 8

Constructs a new ShippingMethodBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\commerce_shipping\PackageTypeManagerInterface $package_type_manager: The package type manager.

\Drupal\state_machine\WorkflowManagerInterface $workflow_manager: The workflow manager.

\Drupal\commerce_usps\USPSRateRequestInterface $usps_rate_request: The rate request service.

Overrides ShippingMethodBase::__construct

File

src/Plugin/Commerce/ShippingMethod/USPSBase.php, line 41

Class

USPSBase

Namespace

Drupal\commerce_usps\Plugin\Commerce\ShippingMethod

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, PackageTypeManagerInterface $package_type_manager, WorkflowManagerInterface $workflow_manager, USPSRateRequestInterface $usps_rate_request) {
  $plugin_definition = $this
    ->preparePluginDefinition($plugin_definition);
  parent::__construct($configuration, $plugin_id, $plugin_definition, $package_type_manager, $workflow_manager);
  $this->uspsRateService = $usps_rate_request;
  $this->uspsRateService
    ->setConfig($configuration);
}