Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Generic.php
Go to the documentation of this file.
1 <?php
7 
10 
14 class Generic implements GenericInterface
15 {
19  protected $shippingUsps;
20 
26  protected $code = '';
27 
32  {
33  $this->shippingUsps = $shippingUsps;
34  }
35 
41  public function toOptionArray()
42  {
43  $options = [];
44  $codes = $this->shippingUsps->getCode($this->code);
45  if ($codes) {
46  foreach ($codes as $code => $title) {
47  $options[] = ['value' => $code, 'label' => __($title)];
48  }
49  }
50  return $options;
51  }
52 }
$title
Definition: default.phtml:14
__construct(Carrier $shippingUsps)
Definition: Generic.php:31
__()
Definition: __.php:13