/** * Loads a package file from a file path. * * If the file does not exist, an empty configuration is returned. * * Loaded package files must have a package name set. If none is set, an * exception is thrown. * * @param string $path The path to the package file. * * @return PackageFile The loaded package file. * * @throws InvalidConfigException If the file contains invalid configuration. */ public function loadPackageFile($path) { try { // Don't use file_exists() to decouple from the file system $packageFile = $this->reader->readPackageFile($path); } catch (FileNotFoundException $e) { $packageFile = new PackageFile(null, $path); } return $packageFile; }