示例#1
0
 /**
  * Dumps services to source file
  *
  * @param string $inputDirectory
  * @param string $outputDirectory
  * @return array
  */
 public function dump($inputDirectory, $outputDirectory)
 {
     $servicesList = array();
     //browses directory for searching service provider classes
     $directoryIterator = new \DirectoryIterator($inputDirectory);
     foreach ($directoryIterator as $fileInfo) {
         if ($fileInfo->isDot()) {
             continue;
         }
         $servicesList[$fileInfo->getBasename('.php')] = $fileInfo->getPathname();
     }
     //saves generated array to php source file
     FileWriter::writeObject($outputDirectory . self::SERVICES_STATIC_FILE, $servicesList, true);
     ksort($servicesList);
     return $servicesList;
 }
示例#2
0
文件: Loader.php 项目: szytko/core
 /**
  * Generates list of modules into source file
  *
  * @param string $inputDirectory
  * @param string $outputDirectory
  * @param bool $dumpVendorModules
  * @return array
  */
 public function dump($inputDirectory, $outputDirectory, $dumpVendorModules = true)
 {
     $modulesList = [];
     //extracts list of modules from module directory
     $directoryIterator = new \DirectoryIterator($inputDirectory);
     foreach ($directoryIterator as $moduleDir) {
         if ($moduleDir->isDot()) {
             continue;
         }
         $moduleSettingsFile = $moduleDir->getPathname() . DIRECTORY_SEPARATOR . self::MODULE_SETTINGS_FILE;
         if (!file_exists($moduleSettingsFile)) {
             continue;
         }
         $modulesList[$moduleDir->getBasename()] = ['className' => $moduleDir->getBasename() . '\\' . pathinfo(self::MODULE_SETTINGS_FILE, PATHINFO_FILENAME), 'path' => $moduleSettingsFile];
     }
     if ($dumpVendorModules) {
         $this->dumpModulesFromVendor($modulesList);
     }
     //saves generated array to php source file
     FileWriter::writeObject($outputDirectory . self::MODULE_STATIC_FILE, $modulesList, true);
     return $modulesList;
 }
示例#3
0
文件: Mapper.php 项目: arius86/core
 /**
  * Saves generated map to file
  *
  * @param string $cacheFilePath     Path to cache file
  * @param array $map    Generated map
  * @return int
  */
 private function cacheMap($cacheFilePath, $map)
 {
     if (!file_exists(dirname($cacheFilePath))) {
         mkdir(dirname($cacheFilePath), 0777, true);
     }
     return FileWriter::writeObject($cacheFilePath, $map, true);
 }