Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdatingServiceFactory.php
Go to the documentation of this file.
1 <?php
7 
11 
18 {
23  private static $caseTest = 'cases/test';
24 
28  private $objectManager;
29 
33  private $generatorFactory;
34 
38  private $config;
39 
47  public function __construct(
48  ObjectManagerInterface $objectManager,
49  GeneratorFactory $generatorFactory,
50  Config $config
51  ) {
52  $this->objectManager = $objectManager;
53  $this->generatorFactory = $generatorFactory;
54  $this->config = $config;
55  }
56 
65  public function create($type)
66  {
67  if (!$this->config->isActive() || $type === self::$caseTest) {
68  return $this->objectManager->create(StubUpdatingService::class);
69  }
70 
71  $messageGenerator = $this->generatorFactory->create($type);
72  $service = $this->objectManager->create(UpdatingService::class, [
73  'messageGenerator' => $messageGenerator
74  ]);
75 
76  return $service;
77  }
78 }
$objectManager
Definition: bootstrap.php:17
$config
Definition: fraud_order.php:17
$type
Definition: item.phtml:13
__construct(ObjectManagerInterface $objectManager, GeneratorFactory $generatorFactory, Config $config)