mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 08:50:50 +00:00
727b9f46f0
bfa1891c50
[cleanup] Remove 73 unused public methods (#3245)
29 lines
851 B
PHP
29 lines
851 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Testing\Fixture;
|
|
|
|
use RectorPrefix202212\Nette\Utils\FileSystem;
|
|
final class FixtureTempFileDumper
|
|
{
|
|
/**
|
|
* @api
|
|
* @var string
|
|
*/
|
|
public const TEMP_FIXTURE_DIRECTORY = '/rector/tests_fixture_';
|
|
public static function dump(string $fileContents, string $suffix = 'php') : string
|
|
{
|
|
// the "php" suffix is important, because that will hook into \Rector\Core\Application\FileProcessor\PhpFileProcessor
|
|
$temporaryFileName = self::getTempDirectory() . '/' . \md5($fileContents) . '.' . $suffix;
|
|
FileSystem::write($temporaryFileName, $fileContents);
|
|
return $temporaryFileName;
|
|
}
|
|
/**
|
|
* @api
|
|
*/
|
|
public static function getTempDirectory() : string
|
|
{
|
|
return \sys_get_temp_dir() . self::TEMP_FIXTURE_DIRECTORY;
|
|
}
|
|
}
|