Newer
Older
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class ReadFileLineByLineController extends AbstractController
{
/**
* Принимает путь до файла,
* проверяет, что файл существует и выводит пользователю построчный вывод используя yield
*
* @param string $filePath путь до файла
* @return Response */
#[Route('/readbyline/{filePath}', name: 'app_read_file_line_by_line')]
public function index(
string $filePath,
ReadFileLineByLineAction $action
) : Response {
foreach ($action->act($filePath) as $line) {