Initial commit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 02:40:42 +03:00
commit 98a4094c5e
53 changed files with 2633 additions and 0 deletions

32
src/ContainerFactory.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace Pronchev\Pinecore;
use DI\Container;
use DI\ContainerBuilder;
class ContainerFactory
{
public static function build(Environment $env, Config $config, string $basePath): Container
{
$builder = new ContainerBuilder();
if ($env->isProd()) {
$cacheDir = $basePath . '/var/cache/prod';
if (!is_dir($cacheDir)) {
mkdir($cacheDir, 0755, true);
}
$builder->enableCompilation($cacheDir);
}
$builder->useAutowiring(true);
$servicesFile = $basePath . '/config/services.php';
if (file_exists($servicesFile)) {
$definitions = require $servicesFile;
$definitions($builder, $config, $basePath);
}
return $builder->build();
}
}