Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigFilePool.php
Go to the documentation of this file.
1 <?php
8 
15 {
16  const APP_CONFIG = 'app_config';
17  const APP_ENV = 'app_env';
18 
22  const LOCAL = 'local';
23 
27  const DIST = 'dist';
28 
34  private $applicationConfigFiles = [
35  self::APP_CONFIG => 'config.php',
36  self::APP_ENV => 'env.php',
37  ];
38 
45  private $initialConfigFiles = [
46  self::DIST => [
47  self::APP_CONFIG => 'config.dist.php',
48  self::APP_ENV => 'env.dist.php',
49  ],
50  self::LOCAL => [
51  self::APP_CONFIG => 'config.local.php',
52  self::APP_ENV => 'env.local.php',
53  ]
54  ];
55 
61  public function __construct($additionalConfigFiles = [])
62  {
63  $this->applicationConfigFiles = array_merge($this->applicationConfigFiles, $additionalConfigFiles);
64  }
65 
71  public function getPaths()
72  {
73  return $this->applicationConfigFiles;
74  }
75 
83  public function getPath($fileKey)
84  {
85  if (!isset($this->applicationConfigFiles[$fileKey])) {
86  throw new \Exception('File config key does not exist.');
87  }
88  return $this->applicationConfigFiles[$fileKey];
89  }
90 
98  public function getInitialFilePools()
99  {
100  return $this->initialConfigFiles;
101  }
102 
111  public function getPathsByPool($pool)
112  {
113  return $this->initialConfigFiles[$pool];
114  }
115 }