- md5
- ccf28176bc260a0ebfe8fb9ac4715fa3
- sha1
- f8eb2a573b980e48db147a99e95ee992624ec7d2
- sha256
- b92ed3e1e90a77fe73ae655aa496d54db69a0376552a1e716636e2a0a41922b2
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Grégoire Pineau <[email protected]>
*/
class SingleCommandApplication extends Command
{
private $version = 'UNKNOWN';
private $running = false;
public function setVersion(string $version): self
{
$this->version = $version;
return $this;
}
public function run(InputInterface $input = null, OutputInterface $output = null): int
{
if ($this->running) {
return parent::run($input, $output);
}
// We use the command name as the application name
$application = new Application($this->getName() ?: 'UNKNOWN', $this->version);
// Fix the usage of the command displayed with "--help"
$this->setName($_SERVER['argv'][0]);
$application->add($this);
$application->setDefaultCommand($this->getName(), true);
$this->running = true;
try {
$ret = $application->run($input, $output);
} finally {
$this->running = false;
}
return $ret ?? 1;
}
}
The same content is in 2 releases, Joomla 4.0.0-beta4 to 4.0.0-beta5. See them all, or every version of this file.