rector/packages/Testing/Fixture/FixtureSplitter.php
Tomas Votruba 727b9f46f0 Updated Rector to commit bfa1891c50677b01136a9308fd3c3ecc12e267d9
bfa1891c50 [cleanup] Remove 73 unused public methods (#3245)
2022-12-23 17:10:25 +00:00

27 lines
721 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Testing\Fixture;
use RectorPrefix202212\Nette\Utils\FileSystem;
use RectorPrefix202212\Nette\Utils\Strings;
use RectorPrefix202212\Webmozart\Assert\Assert;
final class FixtureSplitter
{
/**
* @api
* @var string
* @see https://regex101.com/r/zZDoyy/1
*/
public const SPLIT_LINE_REGEX = '#\\-\\-\\-\\-\\-\\r?\\n#';
/**
* @return array<string, string>
*/
public static function loadFileAndSplitInputAndExpected(string $filePath) : array
{
Assert::fileExists($filePath);
$fixtureFileContents = FileSystem::read($filePath);
return Strings::split($fixtureFileContents, self::SPLIT_LINE_REGEX);
}
}