initial commit

This commit is contained in:
boris
2025-09-30 09:24:25 +01:00
committed by boris
parent a783a12c97
commit c7770ea03b
4695 changed files with 525784 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner\Symfony;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Runtime\RunnerInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class ConsoleApplicationRunner implements RunnerInterface
{
public function __construct(
private readonly Application $application,
private readonly ?string $defaultEnv,
private readonly InputInterface $input,
private readonly ?OutputInterface $output = null,
) {
}
public function run(): int
{
if (null === $this->defaultEnv) {
return $this->application->run($this->input, $this->output);
}
$definition = $this->application->getDefinition();
if (!$definition->hasOption('env') && !$definition->hasOption('e') && !$definition->hasShortcut('e')) {
$definition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $this->defaultEnv));
}
if (!$definition->hasOption('no-debug')) {
$definition->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
}
return $this->application->run($this->input, $this->output);
}
}

View File

@@ -0,0 +1,58 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner\Symfony;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\Runtime\RunnerInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class HttpKernelRunner implements RunnerInterface
{
public function __construct(
private readonly HttpKernelInterface $kernel,
private readonly Request $request,
private readonly bool $debug = false,
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
if (Kernel::VERSION_ID >= 60400) {
$response->send(false);
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
fastcgi_finish_request();
} elseif (\function_exists('litespeed_finish_request') && !$this->debug) {
litespeed_finish_request();
} else {
Response::closeOutputBuffers(0, true);
flush();
}
} else {
$response->send();
}
if ($this->kernel instanceof TerminableInterface) {
$this->kernel->terminate($this->request, $response);
}
return 0;
}
}

View File

@@ -0,0 +1,33 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner\Symfony;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Runtime\RunnerInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class ResponseRunner implements RunnerInterface
{
public function __construct(
private readonly Response $response,
) {
}
public function run(): int
{
$this->response->send();
return 0;
}
}