@param FilePath $filePath

@return FilePath
760285
protected function getLockPath(FilePath $filePath)
    {
        $name = $filePath->getName();
        $relativeLockPath = $filePath->getParentPath()->appendFile('.' . $name . '.lock');

        return $relativeLockPath;
    }
255699
public function download($filePath)
    {
        $urlParts = parse_url($filePath);
        $rootDir = null;

        if (!is_null($this->rootDir)) {
            $rootDir = $this->rootDir;
        } else {
            $rootDir = CYGNITE_BASE.DS;
        }

        $filePath = $rootDir.str_replace('/', DS, str_replace('/'.ROOTDIR.'/', '', $urlParts['path']));

        if (is_null($this->filePath) && $filePath != '') {
            $this->filePath = $filePath;
        }

        $isSetFileType = $this->setMimeType($this->filePath);

        if ($isSetFileType) {
            $this->setHeaders();
        }
        //$this->filePath
    }
176073
public function getFileContent( string$filePath ):string
	{
		return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath);
	}
464499
public function getModuleNameByFilePath(string $filePath): string
    {
        $modulePath = str_replace([
            $this->pathBuilder->getCorePath($filePath),
            $this->pathBuilder->getProjectPath($filePath),
        ], '', $filePath);

        $modulePath = explode(DIRECTORY_SEPARATOR, $modulePath);

        return ucfirst(array_shift($modulePath));
    }
262415
public function extract($filePath)
    {
        $directory = $this->directory->getDirectoryPath();
        $pharArchive = new Phar($filePath);
        $pharArchive->extractTo($directory);

        return $this->createFinderFromDirectory($directory);
    }
802292
private function getFilePath($filePath = null)
    {
        $filePath = $filePath ?? $this->filePath ?? null;

        if (null === $filePath) {
            throw NoFilePathGivenException::import();
        }

        return $filePath;
    }
39418
public function readFile($filePath)
    {
        try {
            $file = fopen($filePath, 'r');
            $content = fread($file, filesize($filePath));
            fclose($file);
            return $content;
        } catch (\Exception $e) {
            return '';
        }
    }
1096007
private function getFileExtensionFromFilepath($filepath)
    {
        $fileExtension = pathinfo($filepath, PATHINFO_EXTENSION);

        if (empty($fileExtension)) {
            throw new \Exception('File extension not found');
        }

        return $fileExtension;
    }
1069100
public static function openFile($filepath)
    {
        $contents = null;

        if ($realPath = realpath($filepath)) {
            $handle = fopen($realPath, 'rb');
            $contents = fread($handle, filesize($realPath));
            fclose($handle);
        }

        return $contents;
    }
51614
public function filetime($filePath)
    {
        $filePath = realpath($filePath);

        if ($this->fileIsReadable($filePath)) {
            return filemtime($filePath);
        }

        // Fallback to the current timestamp.
        // We are not interested in old file.
        // The current timestamp indicates, that this not-existing file is new.
        return time();
    }
192979
public function downloadAction($filePath)
    {
        $response = new Response();

        if (!$this->authenticate($filePath)) {
            return $response->setStatusCode(Response::HTTP_UNAUTHORIZED);
        }

        $content = $this->fileSystem->load($filePath);

        $response->headers->set('Content-Type', 'mime/type');
        $response->headers->set('Content-Disposition', 'attachment;filename="' . $filePath);

        $response->setContent($content);

        return $response;
    }
81245
public function setFile(string $filePath): self
    {
        IOExpect::isFile($filePath);
        IOExpect::isReadable($filePath);

        $this->file = $filePath;

        return $this;
    }
1186239
private function makePathRelative($filePath)
    {
        $thisFilePath = __FILE__;
        $thisFilePathParts = explode('/src/', $thisFilePath);
        $projectRootDir = $thisFilePathParts[0].DIRECTORY_SEPARATOR;

        return str_replace($projectRootDir, '', $filePath);
    }
139359
protected function backupFile($filePath)
    {
        $sourcePath = $filePath;
        $backupPath = $filePath.'.bak';

        if (file_exists($backupPath)) {
            $date = new \DateTime();
            $backupPath = "{$filePath}{$date->getTimestamp()}.bak";
        }

        copy($sourcePath, $backupPath);

        return $backupPath;
    }
996182
public static function readFile($filePath)
    {
        if (false === self::exists($filePath)) {
            throw new RuntimeException(sprintf('unable to find "%s"', $filePath));
        }
        if (false === $fileData = file_get_contents($filePath)) {
            throw new RuntimeException(sprintf('unable to read file "%s"', $filePath));
        }

        return $fileData;
    }
993401
public function setFile($filePath)
    {
        if (is_file($filePath)) {
            $this->file = new SplFileInfo($filePath);

            if (file_exists(
                $propertiesFilePath = $this->file->getPath() . DIRECTORY_SEPARATOR . str_replace(
                        '.phtml',
                        '.json',
                        strtolower($this->file->getBasename())
                    )
            )) {
                $properties = file_get_contents($propertiesFilePath);
                $properties = json_decode($properties, true);

                if (isset($properties[ 'vars' ])) {
                    $this->vars = $properties[ 'vars' ];
                }

                if (isset($properties[ 'presets' ])) {
                    $this->presets = new SplArrayObject($properties[ 'presets' ]);
                }
            }
        }

        return $this;
    }
1094637
public static function getFilename($filepath)
    {
        $explode_filepath = explode('/', $filepath);
        return \Library\Helper\File::getHumanReadableFilename(end($explode_filepath));
    }