Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeployStrategyFactory.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  const DEPLOY_STRATEGY_STANDARD = 'standard';
20 
24  const DEPLOY_STRATEGY_QUICK = 'quick';
25 
29  const DEPLOY_STRATEGY_COMPACT = 'compact';
30 
34  private $objectManager;
35 
41  private $strategies = [];
42 
49  public function __construct(ObjectManagerInterface $objectManager, array $strategies = [])
50  {
51  $this->objectManager = $objectManager;
52  $defaultStrategies = [
53  self::DEPLOY_STRATEGY_STANDARD => StandardDeploy::class,
54  self::DEPLOY_STRATEGY_QUICK => QuickDeploy::class,
55  self::DEPLOY_STRATEGY_COMPACT => CompactDeploy::class,
56  ];
57  $this->strategies = array_replace($defaultStrategies, $strategies);
58  }
59 
68  public function create($type, array $arguments = [])
69  {
71  if (!isset($this->strategies[$type])) {
72  throw new InputException(__('Wrong deploy strategy type: %1', $type));
73  }
74  return $this->objectManager->create($this->strategies[$type], $arguments);
75  }
76 }
$objectManager
Definition: bootstrap.php:17
__()
Definition: __.php:13
$type
Definition: item.phtml:13
__construct(ObjectManagerInterface $objectManager, array $strategies=[])
$arguments