mirror of
https://gh.wpcy.net/https://github.com/aspirepress/AspireCloud.git
synced 2026-05-31 00:04:27 +08:00
* feat: add ClosedPlugin model * fix: don't chop line if it doesn't end with \n * build: rm unused robmorgan/phinx dependency * chore: rm all App\Models\Sync classes * feat: new unified plugin and theme loader * docs: update README.md * fix: fix or suppress phpstan warnings * docs: fix dump commands in readme * feat: add ac_origin column to all resource tables * chore: add ac_* columns including ac_raw_metadata we used to point to the raw metadata in the corresponding SyncPlugin/SyncTheme record, but that's gone. thus, adding it as a column. * chore: mark eloquent properties as readonly in phpdoc * fix: drop bogus HasFactory from Author
26 lines
494 B
PHP
26 lines
494 B
PHP
<?php
|
|
|
|
namespace App\Utils;
|
|
|
|
use Generator;
|
|
use SplFileObject;
|
|
|
|
final class File
|
|
{
|
|
public static function lazyLines(string $filename): Generator
|
|
{
|
|
$file = new SplFileObject($filename);
|
|
while (!$file->eof()) {
|
|
$line = $file->fgets();
|
|
if (str_ends_with($line, "\n")) {
|
|
$line = substr($line, 0, -1);
|
|
}
|
|
yield $line;
|
|
}
|
|
}
|
|
|
|
private function __construct()
|
|
{
|
|
// not instantiable
|
|
}
|
|
}
|