Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainlineCE/develop' into PR_Branch
Browse files Browse the repository at this point in the history
Conflicts:
	composer.lock
  • Loading branch information
mazhalai committed Apr 8, 2015
2 parents d95c3ea + c915f36 commit 6f1962a
Show file tree
Hide file tree
Showing 163 changed files with 5,169 additions and 1,585 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
namespace Magento\Customer\Block\Address\Renderer;

use Magento\Customer\Model\Address\AbstractAddress;
use Magento\Customer\Model\Address\AddressModelInterface;
use Magento\Customer\Model\Address\Mapper;
use Magento\Customer\Model\Metadata\ElementFactory;
use Magento\Framework\View\Element\AbstractBlock;
Expand Down Expand Up @@ -111,7 +111,7 @@ public function getFormat(AbstractAddress $address = null)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function render(AbstractAddress $address, $format = null)
public function render(AddressModelInterface $address, $format = null)
{
$address = $address->getDataModel(0, 0);
return $this->renderArray($this->addressMapper->toFlatArray($address), $format);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Customer\Block\Address\Renderer;

use Magento\Directory\Model\Country\Format;
use Magento\Customer\Model\Address\AddressModelInterface;

/**
* Address renderer interface
Expand All @@ -32,12 +33,12 @@ public function getType();
/**
* Render address
*
* @param \Magento\Customer\Model\Address\AbstractAddress $address
* @param AddressModelInterface $address
* @param string|null $format
* @return mixed
* @deprecated All new code should use renderArray based on Metadata service
*/
public function render(\Magento\Customer\Model\Address\AbstractAddress $address, $format = null);
public function render(AddressModelInterface $address, $format = null);

/**
* Get a format object for a given address attributes, based on the type set earlier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @method bool getShouldIgnoreValidation()
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AbstractAddress extends AbstractExtensibleModel
class AbstractAddress extends AbstractExtensibleModel implements AddressModelInterface
{
/**
* Possible customer address types
Expand Down
30 changes: 30 additions & 0 deletions app/code/Magento/Customer/Model/Address/AddressModelInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Customer\Model\Address;

/**
* Interface AddressInterface
*/
interface AddressModelInterface
{
/**
* Get steet line by number
*
* @param int $number
* @return string
*/
public function getStreetLine($number);

/**
* Create fields street1, street2, etc.
*
* To be used in controllers for views data
*
* @return $this
*/
public function explodeStreetAddress();
}
4 changes: 2 additions & 2 deletions app/code/Magento/Payment/Block/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class Info extends \Magento\Framework\View\Element\Template
/**
* Retrieve info model
*
* @return \Magento\Payment\Model\Info
* @return \Magento\Payment\Model\InfoInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getInfo()
{
$info = $this->getData('info');
if (!$info instanceof \Magento\Payment\Model\Info) {
if (!$info instanceof \Magento\Payment\Model\InfoInterface) {
throw new \Magento\Framework\Exception\LocalizedException(
__('We cannot retrieve the payment info model object.')
);
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Payment/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Magento\Quote\Model\Quote;
use Magento\Store\Model\Store;
use Magento\Payment\Block\Form;
use Magento\Payment\Model\Info;
use Magento\Payment\Model\InfoInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\LayoutInterface;
use Magento\Framework\View\LayoutFactory;
Expand Down Expand Up @@ -182,11 +182,11 @@ public function getMethodFormBlock(MethodInterface $method, LayoutInterface $lay
/**
* Retrieve payment information block
*
* @param Info $info
* @param InfoInterface $info
* @param \Magento\Framework\View\LayoutInterface $layout
* @return Template
*/
public function getInfoBlock(Info $info, LayoutInterface $layout = null)
public function getInfoBlock(InfoInterface $info, LayoutInterface $layout = null)
{
$layout = $layout ?: $this->_layout;
$blockType = $info->getMethodInstance()->getInfoBlockType();
Expand All @@ -198,12 +198,12 @@ public function getInfoBlock(Info $info, LayoutInterface $layout = null)
/**
* Render payment information block
*
* @param Info $info
* @param InfoInterface $info
* @param int $storeId
* @return string
* @throws \Exception
*/
public function getInfoBlockHtml(Info $info, $storeId)
public function getInfoBlockHtml(InfoInterface $info, $storeId)
{
$this->_appEmulation->startEnvironmentEmulation($storeId);

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Model/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Payment information model
*/
class Info extends AbstractExtensibleModel
class Info extends AbstractExtensibleModel implements InfoInterface
{
/**
* Additional information container
Expand Down
70 changes: 70 additions & 0 deletions app/code/Magento/Payment/Model/InfoInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Payment\Model;

/**
* Interface InfoInterface
*/
interface InfoInterface
{
/**
* Encrypt data
*
* @param string $data
* @return string
*/
public function encrypt($data);

/**
* Decrypt data
*
* @param string $data
* @return string
*/
public function decrypt($data);

/**
* Set Additional information about payment into Payment model
*
* @param string $key
* @param string|null $value
* @return mixed
*/
public function setAdditionalInformation($key, $value = null);

/**
* Check whether there is additional information by specified key
*
* @param mixed|null $key
* @return bool
*/
public function hasAdditionalInformation($key = null);

/**
* Unsetter for entire additional_information value or one of its element by key
*
* @param string|null $key
* @return $this
*/
public function unsAdditionalInformation($key = null);

/**
* Getter for entire additional_information value or one of its element by key
*
* @param string|null $key
* @return mixed
*/
public function getAdditionalInformation($key = null);

/**
* Retrieve payment method model object
*
* @return \Magento\Payment\Model\MethodInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getMethodInstance();
}
18 changes: 9 additions & 9 deletions app/code/Magento/Payment/Model/Method/AbstractMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,12 @@ public function canFetchTransactionInfo()
/**
* Fetch transaction info
*
* @param \Magento\Payment\Model\Info $payment
* @param \Magento\Payment\Model\InfoInterface $payment
* @param string $transactionId
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function fetchTransactionInfo(\Magento\Payment\Model\Info $payment, $transactionId)
public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId)
{
return [];
}
Expand Down Expand Up @@ -497,7 +497,7 @@ public function getInfoBlockType()
public function getInfoInstance()
{
$instance = $this->getData('info_instance');
if (!$instance instanceof \Magento\Payment\Model\Info) {
if (!$instance instanceof \Magento\Payment\Model\InfoInterface) {
throw new \Magento\Framework\Exception\LocalizedException(__('We cannot retrieve the payment information object instance.'));
}
return $instance;
Expand Down Expand Up @@ -673,23 +673,23 @@ public function void(\Magento\Framework\Object $payment)
/**
* Whether this method can accept or deny payment
*
* @param \Magento\Payment\Model\Info $payment
* @param \Magento\Payment\Model\InfoInterface $payment
* @return bool
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function canReviewPayment(\Magento\Payment\Model\Info $payment)
public function canReviewPayment(\Magento\Payment\Model\InfoInterface $payment)
{
return $this->_canReviewPayment;
}

/**
* Attempt to accept a payment that us under review
*
* @param \Magento\Payment\Model\Info $payment
* @param \Magento\Payment\Model\InfoInterface $payment
* @return false
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function acceptPayment(\Magento\Payment\Model\Info $payment)
public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment)
{
if (!$this->canReviewPayment($payment)) {
throw new \Magento\Framework\Exception\LocalizedException(__('The payment review action is unavailable.'));
Expand All @@ -700,11 +700,11 @@ public function acceptPayment(\Magento\Payment\Model\Info $payment)
/**
* Attempt to deny a payment that us under review
*
* @param \Magento\Payment\Model\Info $payment
* @param \Magento\Payment\Model\InfoInterface $payment
* @return false
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function denyPayment(\Magento\Payment\Model\Info $payment)
public function denyPayment(\Magento\Payment\Model\InfoInterface $payment)
{
if (!$this->canReviewPayment($payment)) {
throw new \Magento\Framework\Exception\LocalizedException(__('The payment review action is unavailable.'));
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Payment/Test/Unit/Block/Info/CcTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ public function testGetCcExpDate($ccExpMonth, $ccExpYear)
$paymentInfo
->expects($this->any())
->method('getCcExpMonth')
->will($this->returnValue($ccExpMonth));
->willReturn($ccExpMonth);
$paymentInfo
->expects($this->any())
->method('getCcExpYear')
->will($this->returnValue($ccExpYear));
->willReturn($ccExpYear);
$this->model->setData('info', $paymentInfo);

$this->localeDate
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Test/Unit/Model/InfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class InfoTest extends \PHPUnit_Framework_TestCase
{
/** @var \Magento\Payment\Model\Info */
/** @var \Magento\Payment\Model\InfoInterface */
protected $info;

/** @var ObjectManagerHelper */
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Reports/Model/Resource/Order/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot
* @param \Magento\Framework\DB\Helper $coreResourceHelper
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Sales\Model\Order\Config $orderConfig
* @param \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory
* @param mixed $connection
* @param null $connection
* @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
Expand All @@ -80,6 +81,7 @@ public function __construct(
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot,
\Magento\Framework\DB\Helper $coreResourceHelper,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Store\Model\StoreManagerInterface $storeManager,
Expand All @@ -94,6 +96,7 @@ public function __construct(
$logger,
$fetchStrategy,
$eventManager,
$entitySnapshot,
$coreResourceHelper,
$connection,
$resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ public function getHeaderText()
return __(
'Credit Memo #%1 | %3 | %2 (%4)',
$this->getCreditmemo()->getIncrementId(),
$this->formatDate($this->getCreditmemo()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true),
$this->formatDate(
$this->_localeDate->date(new \DateTime($this->getCreditmemo()->getCreatedAt())),
\IntlDateFormatter::MEDIUM,
true
),
$this->getCreditmemo()->getStateName(),
$emailSent
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ public function getHeaderText()
$this->getInvoice()->getIncrementId(),
$this->getInvoice()->getStateName(),
$emailSent,
$this->formatDate($this->getInvoice()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true)
$this->formatDate(
$this->_localeDate->date(new \DateTime($this->getInvoice()->getCreatedAt())),
\IntlDateFormatter::MEDIUM,
true
)
);
}

Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Sales/Block/Adminhtml/Order/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* Adminhtml sales order view
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class View extends \Magento\Backend\Block\Widget\Form\Container
{
Expand Down Expand Up @@ -287,7 +288,11 @@ public function getHeaderText()
'Order # %1 %2 | %3',
$this->getOrder()->getRealOrderId(),
$_extOrderId,
$this->formatDate($this->getOrder()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true)
$this->formatDate(
$this->_localeDate->date(new \DateTime($this->getOrder()->getCreatedAt())),
\IntlDateFormatter::MEDIUM,
true
)
);
}

Expand Down
Loading

0 comments on commit 6f1962a

Please sign in to comment.