@param IFile $file

@return File
558250
public static function fromExisting(IFile $file) : File
    {
        if ($file instanceof self) {
            return $file;
        } elseif ($file instanceof IUploadedImage) {
            return new UploadedImage($file->getFullPath(), $file->getUploadError(), $file->getClientFileName(), $file->getClientMimeType());
        } elseif ($file instanceof IUploadedFile) {
            return new UploadedFile($file->getFullPath(), $file->getUploadError(), $file->getClientFileName(), $file->getClientMimeType());
        } elseif ($file instanceof IImage) {
            return new Image($file->getFullPath(), $file->getClientFileName());
        } else {
            return new self($file->getFullPath(), $file->getClientFileName());
        }
    }
557216
protected function normalizeFileInfo(IFileInfo $file)
    {
        $normalized = [
            'type' => $file->isDirectory() ? 'dir' : 'file',
            'path' => ltrim($this->getFilePath($file), $this->pathSeparator),
            'timestamp' => $file->getMTime()
        ];

        if (!$file->isDirectory()) {
            $normalized['size'] = $file->getSize();
        }

        return $normalized;
    }
824395
private function copyDistFile(FileInterface $file)
    {
        $distFile = $this->getBaseDirectory()->getFile('config/config.yml.dist');
        $file->write($distFile->read());

        $app = $this->getContainer();
        $app['logger.system']->info(
            sprintf('Copied %s to %s', $distFile->getFullPath(), $file->getFullPath()),
            ['event' => 'extensions']
        );
    }
372359
public static function extension($file = false) {

        if ($file && self::isFile($file)) {

            return pathinfo($file, PATHINFO_EXTENSION);
        }

        return false;
    }
252302
public function initFile($file)
    {
        if (empty($this->cal)) {
            $lines = $this->fileOrUrl($file);

            $this->initLines($lines);
        } else {
            trigger_error('ICal::initFile: Calendar already initialised in constructor', E_USER_NOTICE);
        }

        return $this;
    }
139680
protected function getRealPath($file, $isFile = false)
    {
        if ( ! $file instanceof SplFileInfo) {
            $file = new SplFileInfo($file);
        }

        $realpath = $file->getRealPath();

        if (false === $realpath) {
            throw new InvalidArgumentException(sprintf(
                'The %s "%s" does not exist.',
                ($isFile ? 'file' : 'directory'),
                $file->getPathname()
            ));
        }

        return $realpath;
    }
56882
public function addJS($file, $versioning = null, $if = null)
  {
    $this->js[$file] = array(
      'file'       => $file,
      'versioning' => $versioning,
      'if'         => $if
    );

    return $this;
  }
418239
def select_files_by_ifo_combination(ifocomb, insps):
    
    inspcomb = FileList()
    for ifo, ifile in zip(*insps.categorize_by_attr('ifo')):
        if ifo in ifocomb:
            inspcomb += ifile

    return inspcomb
679547
public function downloadFile(FileInterface $file)
    {
        /**
         * @var string $content
         */
        $content = $this
            ->filesystem
            ->read($this
                ->fileIdentifierTransformer
                ->transform($file)
            );

        $file->setContent($content);

        return $file;
    }
552317
public function withFile($file, $reset=false)
    {
        $file = str_replace('\\', '/', $file);
        if ($pos = strripos($file, $this->getOption('file_ext'))) {
            $file = substr($file, 0, $pos-1);
        }
        $dir = dirname($file);
        if (!isset(static::$instances[$dir])) {
            $instance = new static($this->options);
            $instance->setOption('file', $file);
            static::$instances[$dir] = $instance;
        }
        
        if ($reset) {
            $key = static::$instances[$dir]->getOption('file');
            static::$instances[$dir]->remove($key);
            static::$instances[$dir]->remove($key . '.error');
        }
        
        return static::$instances[$dir];
    }
156093
public function setFile(File $file = null)
    {
        $this->file = $file;

        if (!empty($file)) {
            $size = @getimagesize($file->getPathname());

            if (is_array($size)) {
                list($this->width, $this->height) = $size;
            }

            $this->refreshUpdatedAt();
        }

        return $this;
    }
26861
private function getClassFromFileAndBundle($file, BundleInterface $bundle)
    {
        $root = $bundle->getPath();

        if (0 !== strpos($file, $root)) {
            return;
        }

        $file = substr($file, strlen($root), -4);

        return sprintf('%s%s', $bundle->getNamespace(), str_replace(DIRECTORY_SEPARATOR, '\\', $file));
    }
1090565
public static function loadFile($file)
    {
        $json = new Json();

        return self::create($json->decodeFile($file), $json);
    }
706730
public function addFile(File $file): self
    {
        $directory = $this->getPath();
        $file->moveToDirectory($directory);

        return $this;
    }
474031
public IFile findIFile(File file)
	{
		IPath location = Path.fromOSString(file.getAbsolutePath());
		IFile ifile = project.getFile(location);

		if (ifile == null || !ifile.exists())
		{

			IPath absolutePath = new Path(file.getAbsolutePath());
			// check if the project contains a IFile which maps to the same
			// file system location
			try
			{
				for (IVdmSourceUnit f : getSpecFiles())
				{
					if (f.getFile().getLocation().equals(absolutePath))
						return f.getFile();
				}
			} catch (CoreException e1)
			{
			}

			// project does not contain this file, this means that the file has
			// been include elsewhere and a link will be created to the file
			// instead.
			try
			{
				linkFileToProject(file);
			} catch (CoreException e)
			{
			}

		}
		return ifile;
	}
906663
public function getAssetPath(IFile $file, string $formatName): string
    {
        return implode('/', array_filter([
            Type::$folderPrefix[$file->getType()] . '_' . $formatName,
            $file->getModelAlias(),
            mb_substr($file->getHash(), 0, $this->cacheHashLength),
            $this->getAssetName($file),
        ]));
    }
657936
public function load($file) {
		$this->_origin = $file;
		if(!is_null($file)) {
			if(file_exists($file)) {
				if (is_null($this->_name)) {
					$bits = explode('/', $file);
					$this->_name = preg_replace('~\.tmpl~', '', array_pop($bits));
				}
				$this->_contents = file_get_contents($file);
				$this->_dir = dirname($file);
			}
			else {
				throw new \InvalidArgumentException("file does not exist (". $file .")");
			}
		}
		return $this;
	}