Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
CcType Class Reference
Inheritance diagram for CcType:
Cctype ArrayInterface OptionSourceInterface

Public Member Functions

 getAllowedTypes ()
 
 getCcTypeLabelMap ()
 
 toOptionArray ()
 
- Public Member Functions inherited from Cctype
 __construct (\Magento\Payment\Model\Config $paymentConfig)
 
 getAllowedTypes ()
 
 setAllowedTypes (array $values)
 
 toOptionArray ()
 

Additional Inherited Members

- Protected Attributes inherited from Cctype
 $_allowedTypes = []
 
 $_paymentConfig
 

Detailed Description

Class CcType @codeCoverageIgnore

Definition at line 12 of file CcType.php.

Member Function Documentation

◆ getAllowedTypes()

getAllowedTypes ( )

Allowed credit card types

Returns
string[]

Definition at line 27 of file CcType.php.

28  {
29  return ['VI', 'MC', 'AE', 'DI', 'JCB', 'MI', 'DN', 'CUP'];
30  }

◆ getCcTypeLabelMap()

getCcTypeLabelMap ( )

Returns credit cards types

Returns
array

Definition at line 37 of file CcType.php.

38  {
39  return array_merge($this->specificCardTypesList, $this->_paymentConfig->getCcTypes());
40  }

◆ toOptionArray()

toOptionArray ( )

Return array of options as value-label pairs

Returns
array Format: array(array('value' => '

', 'label' => '<label>'), ...)

Implements OptionSourceInterface.

Definition at line 45 of file CcType.php.

46  {
47  $allowed = $this->getAllowedTypes();
48  $options = [];
49 
50  foreach ($this->getCcTypeLabelMap() as $code => $name) {
51  if (in_array($code, $allowed)) {
52  $options[] = ['value' => $code, 'label' => $name];
53  }
54  }
55 
56  return $options;
57  }
$code
Definition: info.phtml:12
if(!isset($_GET['name'])) $name
Definition: log.php:14

The documentation for this class was generated from the following file: