Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Config Class Reference

Public Member Functions

 __construct (\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\Config\DataInterface $dataStorage, \Magento\Framework\Stdlib\DateTime\DateTime $date)
 
 getCcTypes ()
 
 getMethodsInfo ()
 
 getGroups ()
 
 getMonths ()
 
 getYears ()
 

Data Fields

const YEARS_RANGE = 10
 

Protected Attributes

 $_methods
 
 $_scopeConfig
 
 $_dataStorage
 
 $localeResolver
 
 $_paymentMethodFactory
 
 $_date
 

Detailed Description

Payment configuration model

Used for retrieving configuration data by payment models

@api

Since
100.0.2

Definition at line 20 of file Config.php.

Constructor & Destructor Documentation

◆ __construct()

Construct

Parameters
\Magento\Framework\App\Config\ScopeConfigInterface$scopeConfig
\Magento\Payment\Model\Method\Factory$paymentMethodFactory
\Magento\Framework\Locale\ResolverInterface$localeResolver
\Magento\Framework\Config\DataInterface$dataStorage
\Magento\Framework\Stdlib\DateTime\DateTime$date

Definition at line 74 of file Config.php.

80  {
81  $this->_scopeConfig = $scopeConfig;
82  $this->_dataStorage = $dataStorage;
83  $this->_paymentMethodFactory = $paymentMethodFactory;
84  $this->localeResolver = $localeResolver;
85  $this->_date = $date;
86  }

Member Function Documentation

◆ getCcTypes()

getCcTypes ( )

Get list of credit card types

Returns
array @api

Definition at line 116 of file Config.php.

117  {
118  return $this->_dataStorage->get('credit_cards');
119  }

◆ getGroups()

getGroups ( )

Get payment groups

Returns
array @api

Definition at line 138 of file Config.php.

139  {
140  return $this->_dataStorage->get('groups');
141  }

◆ getMethodsInfo()

getMethodsInfo ( )

Retrieve array of payment methods information

Returns
array @api

Definition at line 127 of file Config.php.

128  {
129  return $this->_dataStorage->get('methods');
130  }

◆ getMonths()

getMonths ( )

Retrieve list of months translation

Returns
array @api

Definition at line 149 of file Config.php.

150  {
151  $data = [];
152  $months = (new DataBundle())->get(
153  $this->localeResolver->getLocale()
154  )['calendar']['gregorian']['monthNames']['format']['wide'];
155  foreach ($months as $key => $value) {
156  $monthNum = ++$key < 10 ? '0' . $key : $key;
157  $data[$key] = $monthNum . ' - ' . $value;
158  }
159  return $data;
160  }
$value
Definition: gender.phtml:16

◆ getYears()

getYears ( )

Retrieve array of available years

Returns
array @api

Definition at line 168 of file Config.php.

169  {
170  $years = [];
171  $first = (int)$this->_date->date('Y');
172  for ($index = 0; $index <= self::YEARS_RANGE; $index++) {
173  $year = $first + $index;
174  $years[$year] = $year;
175  }
176  return $years;
177  }
$index
Definition: list.phtml:44

Field Documentation

◆ $_dataStorage

$_dataStorage
protected

Definition at line 42 of file Config.php.

◆ $_date

$_date
protected

Definition at line 63 of file Config.php.

◆ $_methods

$_methods
protected

Definition at line 30 of file Config.php.

◆ $_paymentMethodFactory

$_paymentMethodFactory
protected

Definition at line 56 of file Config.php.

◆ $_scopeConfig

$_scopeConfig
protected

Definition at line 37 of file Config.php.

◆ $localeResolver

$localeResolver
protected

Definition at line 49 of file Config.php.

◆ YEARS_RANGE

const YEARS_RANGE = 10

Years range

Definition at line 25 of file Config.php.


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