Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PackageFactory.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Deploy\Package;
7 
11 
18 {
24  private $objectManager;
25 
32  public function __construct(ObjectManagerInterface $objectManager, $type = Package::class)
33  {
34  $this->objectManager = $objectManager;
35  $this->type = $type;
36  }
37 
48  public function create(array $arguments)
49  {
50  $package = $this->objectManager->create($this->type, $arguments);
51  if (!$package instanceof Package) {
52  throw new LocalizedException(
53  new Phrase("Wrong type specified: '%1'", [$this->type])
54  );
55  }
56  return $package;
57  }
58 }
$objectManager
Definition: bootstrap.php:17
$type
Definition: item.phtml:13
$arguments
__construct(ObjectManagerInterface $objectManager, $type=Package::class)