Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QuoteAdapter.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
21  private $quote;
22 
26  private $addressAdapterFactory;
27 
32  public function __construct(
33  CartInterface $quote,
34  AddressAdapterFactory $addressAdapterFactory
35  ) {
36  $this->quote = $quote;
37  $this->addressAdapterFactory = $addressAdapterFactory;
38  }
39 
45  public function getCurrencyCode()
46  {
47  return $this->quote->getCurrency()->getBaseCurrencyCode();
48  }
49 
55  public function getOrderIncrementId()
56  {
57  return $this->quote->getReservedOrderId();
58  }
59 
65  public function getCustomerId()
66  {
67  return $this->quote->getCustomer()->getId();
68  }
69 
75  public function getBillingAddress()
76  {
77  if ($this->quote->getBillingAddress()) {
78  return $this->addressAdapterFactory->create(
79  ['address' => $this->quote->getBillingAddress()]
80  );
81  }
82 
83  return null;
84  }
85 
91  public function getShippingAddress()
92  {
93  if ($this->quote->getShippingAddress()) {
94  return $this->addressAdapterFactory->create(
95  ['address' => $this->quote->getShippingAddress()]
96  );
97  }
98 
99  return null;
100  }
101 
107  public function getStoreId()
108  {
109  return $this->quote->getStoreId();
110  }
111 
117  public function getId()
118  {
119  return $this->quote->getId();
120  }
121 
127  public function getGrandTotalAmount()
128  {
129  return null;
130  }
131 
137  public function getItems()
138  {
139  return $this->quote->getItems();
140  }
141 
147  public function getRemoteIp()
148  {
149  return null;
150  }
151 }
$quote
__construct(CartInterface $quote, AddressAdapterFactory $addressAdapterFactory)