Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TotalsCollectorList.php
Go to the documentation of this file.
1 <?php
2 
9 
11 use Magento\Quote\Model\Quote\Address\Total\CollectorFactory;
13 
15 {
16 
22  protected $totalCollector;
23 
28 
34  protected $_eventPrefix = 'sales_quote_address';
35 
41  protected $_eventObject = 'quote_address';
42 
48  protected $eventManager;
49 
53  protected $storeManager;
54 
58  protected $totalFactory;
59 
67  public function __construct(
69  CollectorFactory $totalCollectorFactory,
70  \Magento\Framework\Event\ManagerInterface $eventManager,
73  ) {
74  $this->totalCollector = $totalCollector;
75  $this->totalCollectorFactory = $totalCollectorFactory;
76  $this->eventManager = $eventManager;
77  $this->storeManager = $storeManager;
78  $this->totalFactory = $totalFactory;
79  }
80 
85  private function getTotalCollector($storeId)
86  {
87  if ($this->totalCollector === null) {
88  $store = $this->storeManager->getStore($storeId);
89 
90  $this->totalCollector = $this->totalCollectorFactory->create(
91  ['store' => $store]
92  );
93  }
94  return $this->totalCollector;
95  }
96 
101  public function getCollectors($storeId)
102  {
103  return $this->getTotalCollector($storeId)->getCollectors();
104  }
105 }
__construct(Collector $totalCollector, CollectorFactory $totalCollectorFactory, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Quote\Model\Quote\Address\TotalFactory $totalFactory)