Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DataFactory.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
16  const AREA_FRONTEND = 'frontend';
17  const AREA_BACKEND = 'adminhtml';
18 
22  protected $objectManager;
23 
27  protected $helperMap = [
28  self::AREA_FRONTEND => \Magento\Authorizenet\Helper\Data::class,
29  self::AREA_BACKEND => \Magento\Authorizenet\Helper\Backend\Data::class
30  ];
31 
38  {
39  $this->objectManager = $objectManager;
40  }
41 
49  public function create($area)
50  {
51  if (!isset($this->helperMap[$area])) {
52  throw new LocalizedException(__(sprintf('For this area <%s> no suitable helper', $area)));
53  }
54 
55  return $this->objectManager->get($this->helperMap[$area]);
56  }
57 }
__()
Definition: __.php:13
__construct(ObjectManagerInterface $objectManager)
Definition: DataFactory.php:37