Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FileReader.php
Go to the documentation of this file.
1 <?php
7 
12 
19 {
25  private $dirList;
26 
32  private $configFilePool;
33 
39  private $driverPool;
40 
46  public function __construct(
47  DirectoryList $dirList,
48  DriverPool $driverPool,
49  ConfigFilePool $configFilePool
50  ) {
51  $this->dirList = $dirList;
52  $this->configFilePool = $configFilePool;
53  $this->driverPool = $driverPool;
54  }
55 
64  public function load($fileKey)
65  {
66  $path = $this->dirList->getPath(DirectoryList::CONFIG);
67  $fileDriver = $this->driverPool->getDriver(DriverPool::FILE);
68  $filePath = $path . '/' . $this->configFilePool->getPath($fileKey);
69 
70  if ($fileDriver->isExists($filePath)) {
71  return include $filePath;
72  }
73 
74  return [];
75  }
76 }
__construct(DirectoryList $dirList, DriverPool $driverPool, ConfigFilePool $configFilePool)
Definition: FileReader.php:46
if(!file_exists($installConfigFile)) $dirList
Definition: bootstrap.php:57