Spatie\Backup\Tasks\Backup\Zip::determineNameOfFileInZip PHP Method

determineNameOfFileInZip() protected static method

protected static determineNameOfFileInZip ( string $pathToFile, string $pathToZip )
$pathToFile string
$pathToZip string
    protected static function determineNameOfFileInZip(string $pathToFile, string $pathToZip)
    {
        $zipDirectory = pathinfo($pathToZip, PATHINFO_DIRNAME);
        $fileDirectory = pathinfo($pathToFile, PATHINFO_DIRNAME);
        if (starts_with($fileDirectory, $zipDirectory)) {
            return str_replace($zipDirectory, '', $pathToFile);
        }
        return $pathToFile;
    }