Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
EnvironmentFactory.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\App;
7 
13 
15 {
19  private $relations;
20 
24  private $definitions;
25 
30  public function __construct(
31  RelationsInterface $relations,
32  DefinitionInterface $definitions
33  ) {
34  $this->relations = $relations;
35  $this->definitions = $definitions;
36  }
37 
43  public function createEnvironment()
44  {
45  switch ($this->getMode()) {
46  case Compiled::MODE:
47  return new Compiled($this);
48  break;
49  default:
50  return new Developer($this);
51  }
52  }
53 
59  private function getMode()
60  {
61  if (file_exists(ConfigLoader\Compiled::getFilePath(Area::AREA_GLOBAL))) {
62  return Compiled::MODE;
63  }
64 
65  return Developer::MODE;
66  }
67 
73  public function getDefinitions()
74  {
75  return $this->definitions;
76  }
77 
83  public function getRelations()
84  {
85  return $this->relations;
86  }
87 }
__construct(RelationsInterface $relations, DefinitionInterface $definitions)