Initial commit

This commit is contained in:
2021-12-07 17:26:34 +01:00
commit 0c9fd2e892
15 changed files with 674 additions and 0 deletions

38
src/Commands/Command.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
namespace Spark\Commands;
use Flare\SparkApplication;
use Spark\Environment\Environment;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command as CommandCommand;
abstract class Command extends CommandCommand
{
public function getEnvironment(): Environment
{
/** @var SparkApplication */
$app = $this->getApplication();
if (!$app) return null;
return $app->getEnvironment();
}
public function loadEnvironment(string $path)
{
/** @var SparkApplication */
$app = $this->getApplication();
$app->loadEnvironment($path);
}
public function createEnvironment(string|null $path=null)
{
if (empty($path)) {
$path = getcwd();
}
/** @var SparkApplication */
$app = $this->getApplication();
$app->createEnvironment($path);
$app->loadEnvironment($path);
}
}