Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
IpnFactory.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Paypal\Model;
7 
8 class IpnFactory
9 {
15  protected $_objectManager = null;
16 
20  protected $mapping = [];
21 
28  public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $mapping = [])
29  {
30  $this->_objectManager = $objectManager;
31  $this->mapping = $mapping;
32  }
33 
40  public function create(array $data = [])
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  }
46 }
$objectManager
Definition: bootstrap.php:17
$type
Definition: item.phtml:13
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $mapping=[])
Definition: IpnFactory.php:28