for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Moip\Magento2\Block\Customer;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Block\AbstractCardRenderer;
use Moip\Magento2\Model\Ui\ConfigProviderBase;
class CardRenderer extends AbstractCardRenderer
{
* Can render specified token.
*
* @param PaymentTokenInterface $token
* @return bool
public function canRender(PaymentTokenInterface $token): bool
return $token->getPaymentMethodCode() === ConfigProviderBase::METHOD_CODE_CC;
}
* @return string
public function getNumberLast4Digits(): string
return $this->getTokenDetails()['cc_last4'];
public function getExpDate(): string
return $this->getTokenDetails()['cc_exp_month'].'/'.$this->getTokenDetails()['cc_exp_year'];
public function getIconUrl(): string
return $this->getIconForType($this->getTokenDetails()['cc_type'])['url'];
* @return int
public function getIconHeight(): int
return $this->getIconForType($this->getTokenDetails()['cc_type'])['height'];
public function getIconWidth(): int
return $this->getIconForType($this->getTokenDetails()['cc_type'])['width'];