<?php
namespace PaperKite;
use Csoft\AutoInvoker\AutoInvokeRule\AutoRegisterRule;
use Lightbulb\Symfony\Loader\AutoInvokerFactory;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
public function __construct(string $environment, bool $debug)
{
parent::__construct($environment, $debug);
$this->initializeAutoInvoker($environment);
}
protected function initializeAutoInvoker(string $environment): void
{
$autoInvoker = AutoInvokerFactory::getInstance(
in_array($environment, ['dev', 'staging', 'stagingv2']) ? 'dev' : $environment,
__DIR__ . '/../var/cache'
);
$autoInvoker->addInvokeRule(new AutoRegisterRule([__DIR__ . '/../src']));
$autoInvoker->invoke();
}
}