Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeferredShippingMethodChooserPool.php
Go to the documentation of this file.
1 <?php
7 
16 {
17  private $choosers;
18 
22  public function __construct(array $choosers)
23  {
24  foreach ($choosers as $chooser) {
25  if (!$chooser instanceof DeferredShippingMethodChooserInterface) {
26  throw new \InvalidArgumentException(sprintf(
27  'Invalid configuration. Chooser should be instance of %s.',
28  DeferredShippingMethodChooserInterface::class
29  ));
30  }
31  }
32  $this->choosers = $choosers;
33  }
34 
41  {
42  if (!isset($this->choosers[$type])) {
43  throw new \InvalidArgumentException(sprintf(
44  'Deferred shipping method %s is not registered.',
45  $type
46  ));
47  }
48 
49  return $this->choosers[$type];
50  }
51 }
$type
Definition: item.phtml:13