Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Factory.php
Go to the documentation of this file.
1 <?php
10 namespace Magento\Framework\Backup;
11 
15 
20 class Factory
21 {
27  private $_objectManager;
28 
32  const TYPE_DB = 'db';
33 
37  const TYPE_FILESYSTEM = 'filesystem';
38 
42  const TYPE_SYSTEM_SNAPSHOT = 'snapshot';
43 
47  const TYPE_MEDIA = 'media';
48 
52  const TYPE_SNAPSHOT_WITHOUT_MEDIA = 'nomedia';
53 
59  protected $_allowedTypes;
60 
65  {
66  $this->_objectManager = $objectManager;
67  $this->_allowedTypes = [
73  ];
74  }
75 
83  public function create($type)
84  {
85  if (!in_array($type, $this->_allowedTypes)) {
86  throw new LocalizedException(
87  new Phrase(
88  'Current implementation not supported this type (%1) of backup.',
89  [$type]
90  )
91  );
92  }
93  $class = 'Magento\Framework\Backup\\' . ucfirst($type);
94  return $this->_objectManager->create($class);
95  }
96 }
$objectManager
Definition: bootstrap.php:17
$type
Definition: item.phtml:13
$_option $_optionId $class
Definition: date.phtml:13
__construct(ObjectManagerInterface $objectManager)
Definition: Factory.php:64