Puli\Manager\Json\JsonStorage::loadModuleFile PHP Méthode

loadModuleFile() public méthode

Loads a module file from a file path.
public loadModuleFile ( string $path ) : ModuleFile
$path string The path to the module file.
Résultat Puli\Manager\Api\Module\ModuleFile The loaded module file.
    public function loadModuleFile($path)
    {
        return $this->loadFile($path, 'Puli\\Manager\\Api\\Module\\ModuleFile');
    }

Usage Example

Exemple #1
0
 /**
  * Loads the module file for the module at the given install path.
  *
  * @param string $installPath The absolute install path of the module
  *
  * @return ModuleFile|null The loaded module file or `null` if none
  *                         could be found.
  */
 private function loadModuleFile($installPath)
 {
     if (!file_exists($installPath)) {
         throw FileNotFoundException::forPath($installPath);
     }
     if (!is_dir($installPath)) {
         throw new NoDirectoryException(sprintf('The path %s is a file. Expected a directory.', $installPath));
     }
     try {
         return $this->jsonStorage->loadModuleFile($installPath . '/puli.json');
     } catch (FileNotFoundException $e) {
         // Modules without module files are ok
         return null;
     }
 }