mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
Define HAVE_OMP_PAUSE_RESOURCE_ALL to 0, add additional file system func
This commit is contained in:
@@ -461,6 +461,23 @@ class FileSystem
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public static function replaceFileLineContainsString(string $file, string $find, string $line): false|int
|
||||
{
|
||||
$lines = file($file);
|
||||
if ($lines === false) {
|
||||
throw new FileSystemException('Cannot read file: ' . $file);
|
||||
}
|
||||
foreach ($lines as $key => $value) {
|
||||
if (str_contains($value, $find)) {
|
||||
$lines[$key] = $line . PHP_EOL;
|
||||
}
|
||||
}
|
||||
return file_put_contents($file, implode('', $lines));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
|
||||
Reference in New Issue
Block a user