コード例 #1
0
ファイル: FileManager.php プロジェクト: deltaphp/attach
 public function getSavePath($ext = null, $currentPath = null)
 {
     $configPaths = [];
     if ($ext) {
         $configPaths[] = ["Attach", "filesPath", $ext];
     }
     if ($currentPath) {
         $fileMime = FileSystem::getFileType($currentPath);
         $configPaths[] = ["Attach", "filesPath", $fileMime];
         $fileType = FileSystem::getFileTypeConst($currentPath);
         $configPaths[] = ["Attach", "filesPath", $fileType];
     }
     $configPaths[] = ["Attach", "filesPath", "default"];
     $configPaths[] = ["Attach", "filesPath"];
     $path = $this->getConfig()->getOneIs($configPaths);
     if (is_array($path)) {
         throw new \RuntimeException("Many option for file path available");
     }
     return $path;
 }