Example #1
0
 private function parsePublicFsPath($name)
 {
     $fsPath = new FsPath($name);
     if ($fsPath->isAbsolute()) {
         return $fsPath;
     }
     return $this->publicFsPath->ext($fsPath);
 }
Example #2
0
File: VarStore.php Project: n2n/n2n
 public function requestFileFsPath($category, $module, $folderName, $fileName, $createFolder = false, $createFile = false, $required = true)
 {
     $dirPath = $this->requestDirFsPath($category, $module, $folderName, $createFolder || $createFile, $required);
     $this->validatePathPart($fileName);
     $filePath = new FsPath($dirPath . DIRECTORY_SEPARATOR . $fileName);
     if ($filePath->isFile()) {
         return $filePath;
     }
     if ($createFile) {
         if ($this->filePerm === null) {
             throw new IllegalStateException('File perm not defined for VarStore. Could not create file: ' . $filePath);
         }
         $filePath->createFile($this->filePerm);
         return $filePath;
     }
     if (!$required) {
         return $filePath;
     }
     throw new InvalidPathException('Var file not found: ' . $filePath);
 }