Skip to content

Commit

Permalink
Merge pull request #1240 from magento-engcom/develop-prs
Browse files Browse the repository at this point in the history
Public Pull Requests

#10086
#10082
#9986
#9672
  • Loading branch information
Oleksii Korshenko authored Jun 28, 2017
2 parents 1e19c93 + 74f029b commit 3993417
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 254 deletions.
3 changes: 2 additions & 1 deletion app/code/Magento/Quote/Model/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Framework\Model\AbstractExtensibleModel;
use Magento\Quote\Api\Data\PaymentInterface;
use Magento\Quote\Model\Quote\Address;
use Magento\Quote\Model\Quote\Address\Total as AddressTotal;
use Magento\Sales\Model\Status;

/**
Expand Down Expand Up @@ -1944,7 +1945,7 @@ public function collectTotals()
/**
* Get all quote totals (sorted by priority)
*
* @return array
* @return AddressTotal[]
*/
public function getTotals()
{
Expand Down
6 changes: 4 additions & 2 deletions app/code/Magento/Quote/Model/Quote/Address/Total.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
namespace Magento\Quote\Model\Quote\Address;

/**
* @method string getCode()
*
* @api
*/
class Total extends \Magento\Framework\DataObject
{
/**
* @var array
*/
protected $totalAmounts;
protected $totalAmounts = [];

/**
* @var array
*/
protected $baseTotalAmounts;
protected $baseTotalAmounts = [];

/**
* Serializer interface instance.
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Quote/Model/Quote/Address/TotalFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objManage
*
* @param string $instanceName
* @param array $data
* @return \Magento\Quote\Model\Quote\Address\Total\AbstractTotal
* @return Total\AbstractTotal|Total
*/
public function create($instanceName, array $data = [])
public function create($instanceName = Total::class, array $data = [])
{
return $this->_objectManager->create($instanceName, $data);
}
Expand Down
18 changes: 8 additions & 10 deletions app/code/Magento/Quote/Model/Quote/TotalsReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public function __construct(
/**
* @param \Magento\Quote\Model\Quote $quote
* @param array $total
* @return array
* @return Total[]
*/
public function fetch(\Magento\Quote\Model\Quote $quote, array $total)
{
$output = [];
$total = $this->totalFactory->create(\Magento\Quote\Model\Quote\Address\Total::class)->setData($total);
$total = $this->totalFactory->create()->setData($total);
/** @var ReaderInterface $reader */
foreach ($this->collectorList->getCollectors($quote->getStoreId()) as $reader) {
$data = $reader->fetch($quote, $total);
Expand All @@ -62,7 +62,7 @@ public function fetch(\Magento\Quote\Model\Quote $quote, array $total)

/**
* @param array $total
* @return Total|array
* @return Total|Total[]
*/
protected function convert($total)
{
Expand All @@ -73,22 +73,20 @@ protected function convert($total)
if (count(array_column($total, 'code')) > 0) {
$totals = [];
foreach ($total as $item) {
$totals[] = $this->totalFactory->create(
\Magento\Quote\Model\Quote\Address\Total::class
)->setData($item);
$totals[] = $this->totalFactory->create()->setData($item);
}
return $totals;
}

return $this->totalFactory->create(\Magento\Quote\Model\Quote\Address\Total::class)->setData($total);
return $this->totalFactory->create()->setData($total);
}

/**
* @param Total $totalInstance
* @param array $output
* @return array
* @param Total[] $output
* @return Total[]
*/
protected function merge($totalInstance, $output)
protected function merge(Total $totalInstance, $output)
{
if (array_key_exists($totalInstance->getCode(), $output)) {
$output[$totalInstance->getCode()] = $output[$totalInstance->getCode()]->addData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ body._in-resize {
.action-menu {
left: auto;
min-width: 10rem;
right: 0;
right: auto;
text-align: left;
top: auto;
z-index: 1;
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,5 @@
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
}
},
"minimum-stability": "alpha",
"prefer-stable": true
}
Loading

0 comments on commit 3993417

Please sign in to comment.