不清楚文件类型，根据后缀，使用不同的方法

@param string $file
519570
public function loadFile(string $file)
    {
        $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
        switch ($extension) {
            case "ini":
                $this->loadIni($file);
                break;
            case "xml":
                $this->loadXml($file);
                break;
            case "yml":
                $this->loadYaml($file);
                break;
            case "php":
                $this->loadPhp($file);
                break;
            default:
                //不用处理
                break;
        }
    }
707340
private function removeFileInFileSystem(File $file)
	{
		$filePath = $this->getFilesystemPath($file);

		if (file_exists($filePath)) {
			$result = unlink($filePath);

			if ( ! $result) {
				throw new Exception\RuntimeException("Could not delete '$filePath' from file storage");
			}
		}

		// remove sizes if object is image
		if ($file instanceof Image) {
			$sizes = $file->getImageSizeCollection();
			foreach ($sizes as $size) {
				$sizePath = $this->getImagePath($file, $size->getName());

				if (file_exists($sizePath)) {
					$result = unlink($sizePath);

					if ( ! $result) {
						throw new Exception\RuntimeException("Could not delete '$sizePath' from file storage");
					}
				}
			}
		}
	}
1054408
public function setFile($file)
    {
        if (is_string($file)) {
            $file = new PhingFile($file);
        }
        $this->file = $file;
    }
604021
public function delete($file)
    {
        return ($this->isConnected() === true) ? ftp_delete($this->getConnection(), $file) : false;
    }
213452
public function delete(string $key): bool
    {
        // 获取文件名称和文件位置
        list ($key, $path, $sqlPath) = $this->getFile($key);

        // 取目录
        $fileList = $this->getFileList();

        // 如果不在目录中,未缓存
        if (!isset($fileList[$key])) {
            return false;
        }

        // 删除缓存文件
        unlink($path);
        unlink($sqlPath);

        // 在目录中删除此数据文件,并保存目录
        unset($fileList[$key]);
        $this->setFileList($fileList);

        return parent::delete($key);
    }
1346217
private function deleteFile($file = null) {
        // no file
        if(!$file || is_array($file))
            return false;

        // get a file and delete it
        $file = new File($this->_config['root'] . trim(str_replace('/', DS, $file), DS));
        if($file->exists())
            return $file->delete();

        // nothing found
        return false;
    }
857510
public static final void deleteQuietly(File file)
   {
      if (file != null)
      {
         if (file.isDirectory())
         {
            File[] children = file.listFiles();
            if (children != null)
            {
               for (File child : children)
               {
                  deleteQuietly(child);
               }
            }
         }
         file.delete();
      }
   }
1000445
public function writePoFile(string $file): void
    {
        $source = $this->dumpString();
        $testName = file_exists($file) ? $file : dirname($file);
        $status = is_writable($testName);
        if ($status === true) {
            $status = file_put_contents($file, $source);
        }
        if (false === $status) {
            throw new FileNotWritableException($file);
        }
    }
612052
public function removeLibrinfoFile(File $file)
    {
        if ($this->images->contains($file)) {
            $this->images->removeElement($file);
        }

        return $this;
    }
186997
public static function DeleteFilesFromPath($file)
	{
		$files = self::RetrieveFilesFromFolder($file->PathSuggested(),null);
		foreach ($files as $f)
		{
			if (strpos($f,$file->Extension())!== false)
			{
				self::DeleteFileString($f);
			}
		}
	}
965193
protected function _removeFile($file)
    {
        $_file = new File($file);

        if ($_file->exists()) {
            $_file->delete();

            $folder = $_file->folder();
            if (count($folder->find()) === 0) {
                $folder->delete();
            }
            return true;
        }
        return false;
    }
311379
private function removeFile(File $file)
	{
		$this->removeFileInFileSystem($file);

		if ($file instanceof Image) {
			$em = $this->getDoctrineEntityManager();
			$imageSizeCn = ImageSize::CN();
			$em->createQuery("DELETE FROM $imageSizeCn s WHERE s.master = :master")
				->setParameter('master', $file->getId())
				->execute();
		}

		$entityManager = $this->getDoctrineEntityManager();
		$entityManager->remove($file);
		$entityManager->flush();
	}
713926
public function delete( $file )
	{
		// check for absolut path
		if ( substr( $file, 0, 1 ) == '/' ) 
		{
			return CCFile::delete( $file );
		}
		
		return CCFile::delete( $this->path( $file ) );
	}
308854
protected function imageHandle($file)
    {
        if (substr($file, 0, 1) != '/') {
            $file = '/' . $file;
        }


        //先处理缩略图
        if ($this->thumbnail && ! empty($this->thumbnail['height']) && ! empty($this->thumbnail['width'])) {
            $file = pathinfo($file);
            $file = $file['dirname'] . '/' . $file['filename'] . '.thumbnail.' . $file['extension'];
            Image::thumbnail($this->uploadPath . $file, intval($this->thumbnail['width']), intval($this->thumbnail['height']))
                ->save($this->uploadPath . $file);
        }
        //再处理缩放，默认不缩放
        //...缩放效果非常差劲-，-
        if (isset($this->zoom['height']) && isset($this->zoom['width'])) {
            $size = $this->getSize($this->uploadPath . $file);
            if ($size && $size[0] > 0 && $size[1] > 0) {
                $ratio = min([$this->zoom['height'] / $size[0], $this->zoom['width'] / $size[1], 1]);
                Image::thumbnail($this->uploadPath . $file, ceil($size[0] * $ratio), ceil($size[1] * $ratio))
                    ->save($this->uploadPath . $file);
            }
        }
        //最后生成水印
        if (isset($this->watermark['path']) && file_exists($this->watermark['path'])) {
            if (! isset($this->watermark['position']) or $this->watermark['position'] > 9 or $this->watermark['position'] < 0 or ! is_numeric($this->watermark['position'])) {
                $this->watermark['position'] = 9;
            }
            $size = $this->getSize($this->uploadPath . $file);
            $waterSize = $this->getSize($this->watermark['path']);
            if ($size[0] > $waterSize[0] and $size[1] > $waterSize[1]) {
                $halfX = $size[0] / 2;
                $halfY = $size[1] / 2;
                $halfWaterX = $waterSize[0] / 2;
                $halfWaterY = $waterSize[1] / 2;
                switch (intval($this->watermark['position'])) {
                    case 1:
                        $x = 0;
                        $y = 0;
                        break;
                    case 2:
                        $x = $halfX - $halfWaterX;
                        $y = 0;
                        break;
                    case 3:
                        $x = $size[0] - $waterSize[0];
                        $y = 0;
                        break;
                    case 4:
                        $x = 0;
                        $y = $halfY - $halfWaterY;
                        break;
                    case 5:
                        $x = $halfX - $halfWaterX;
                        $y = $halfY - $halfWaterY;
                        break;
                    case 6:
                        $x = $size[0] - $waterSize[0];
                        $y = $halfY - $halfWaterY;
                        break;
                    case 7:
                        $x = 0;
                        $y = $size[1] - $waterSize[1];
                        break;
                    case 8:
                        $x = $halfX - $halfWaterX;
                        $y = $size[1] - $waterSize[1];
                        break;
                    case 9:
                    default:
                        $x = $size[0] - $waterSize[0];
                        $y = $size[1] - $waterSize[1];
                }
                Image::watermark($this->uploadPath . $file, $this->watermark['path'], [$x, $y])
                    ->save($this->uploadPath . $file);
            }
        }

        return $file;
    }
940203
private function shouldCopyFileInstead($file)
    {
        // Check if it should not be processed.
        if ($this->isExcludedFromVerbatim($file)) {
            return false;
        }

        foreach ($this->copyVerbatimPatterns as $pattern) {
            if (Str::is($pattern, $file)) {
                return true;
            }
        }

        return false;
    }
985595
public function fileDelete($file)
    {
        foreach ($this->files($file) as $f) {
            if (!unlink($f) && $this->fileExists($f)) {
                throw new RuntimeException(['delete `:file` failed: :last_error_message', 'file' => $f]);
            }
        }
    }
171829
public static function delete($file)
	{
		$files = (array) $file;

		foreach ($files as $file)
		{
			$file     = Path::clean($file);
			$filename = basename($file);

			if (!Path::canChmod($file))
			{
				throw new FilesystemException(__METHOD__ . ': Failed deleting inaccessible file ' . $filename);
			}

			// Try making the file writable first. If it's read-only, it can't be deleted
			// on Windows, even if the parent folder is writable
			@chmod($file, 0777);

			// In case of restricted permissions we zap it one way or the other
			// as long as the owner is either the webserver or the ftp
			if (!@ unlink($file))
			{
				throw new FilesystemException(__METHOD__ . ': Failed deleting ' . $filename);
			}
		}

		return true;
	}