Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ComposerFactory.php
Go to the documentation of this file.
1 <?php
7 
8 use Composer\IO\BufferIO;
10 
12 {
16  private $directoryList;
17 
21  private $composerJsonFinder;
22 
27  public function __construct(
28  DirectoryList $directoryList,
29  ComposerJsonFinder $composerJsonFinder
30  ) {
31  $this->directoryList = $directoryList;
32  $this->composerJsonFinder = $composerJsonFinder;
33  }
34 
41  public function create()
42  {
43  putenv('COMPOSER_HOME=' . $this->directoryList->getPath(DirectoryList::COMPOSER_HOME));
44 
45  return \Composer\Factory::create(
46  new BufferIO(),
47  $this->composerJsonFinder->findComposerJson()
48  );
49  }
50 }
__construct(DirectoryList $directoryList, ComposerJsonFinder $composerJsonFinder)