createTemporaryFilePath($filePath); $clearedFileContents = Strings::replace($fileContents, self::BLEEDING_EDGE_REGEX); FileSystem::write($temporaryFilePath, $clearedFileContents); return $temporaryFilePath; } private function createTemporaryFilePath(string $filePath) : string { $fileDirectory = \dirname($filePath); $baseFileName = \pathinfo($filePath, \PATHINFO_BASENAME); $randomBytes = \random_bytes(10); $randomString = \bin2hex($randomBytes); return $fileDirectory . '/temp_' . $randomString . '_' . $baseFileName; } }