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

Public Member Functions

 __construct (\Magento\Framework\ObjectManagerInterface $objectManager, array $mapping=[])
 
 create (array $data=[])
 

Protected Attributes

 $_objectManager = null
 
 $mapping = []
 

Detailed Description

Definition at line 8 of file IpnFactory.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\ObjectManagerInterface  $objectManager,
array  $mapping = [] 
)

Factory constructor

Parameters
\Magento\Framework\ObjectManagerInterface$objectManager
array$mapping

Definition at line 28 of file IpnFactory.php.

29  {
30  $this->_objectManager = $objectManager;
31  $this->mapping = $mapping;
32  }
$objectManager
Definition: bootstrap.php:17

Member Function Documentation

◆ create()

create ( array  $data = [])

Create class instance with specified parameters

Parameters
array$data
Returns
\Magento\Paypal\Model\IpnInterface

Definition at line 40 of file IpnFactory.php.

41  {
42  $type = isset($data['data']['txn_type']) ? $data['data']['txn_type'] : '';
43  $instanceType = isset($this->mapping[$type]) ? $this->mapping[$type] : \Magento\Paypal\Model\Ipn::class;
44  return $this->_objectManager->create($instanceType, $data);
45  }
$type
Definition: item.phtml:13

Field Documentation

◆ $_objectManager

$_objectManager = null
protected

Definition at line 15 of file IpnFactory.php.

◆ $mapping

$mapping = []
protected

Definition at line 20 of file IpnFactory.php.


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