| Total Complexity | 6 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class CardRenderer extends AbstractCardRenderer |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Can render specified token. |
||
| 19 | * |
||
| 20 | * @param PaymentTokenInterface $token |
||
| 21 | * |
||
| 22 | * @return bool |
||
| 23 | */ |
||
| 24 | public function canRender(PaymentTokenInterface $token): bool |
||
| 25 | { |
||
| 26 | return $token->getPaymentMethodCode() === ConfigProviderBase::METHOD_CODE_CC; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Get Last Numbers. |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function getNumberLast4Digits(): string |
||
| 35 | { |
||
| 36 | return $this->getTokenDetails()['cc_last4']; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get Expiration Date. |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | public function getExpDate(): string |
||
| 45 | { |
||
| 46 | return $this->getTokenDetails()['cc_exp_month'].'/'.$this->getTokenDetails()['cc_exp_year']; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Get Icon Url. |
||
| 51 | * |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | public function getIconUrl(): string |
||
| 55 | { |
||
| 56 | return $this->getIconForType($this->getTokenDetails()['cc_type'])['url']; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Get Icon Height. |
||
| 61 | * |
||
| 62 | * @return int |
||
| 63 | */ |
||
| 64 | public function getIconHeight(): int |
||
| 65 | { |
||
| 66 | return $this->getIconForType($this->getTokenDetails()['cc_type'])['height']; |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Get Icon Width. |
||
| 71 | * |
||
| 72 | * @return int |
||
| 73 | */ |
||
| 74 | public function getIconWidth(): int |
||
| 77 | } |
||
| 78 | } |
||
| 79 |