_objectManager = $objectManager; $this->mapping = $mapping; } /** * Create class instance with specified parameters * * @param array $data * @return \Magento\Paypal\Model\IpnInterface */ public function create(array $data = []) { $type = isset($data['data']['txn_type']) ? $data['data']['txn_type'] : ''; $instanceType = isset($this->mapping[$type]) ? $this->mapping[$type] : \Magento\Paypal\Model\Ipn::class; return $this->_objectManager->create($instanceType, $data); } }