eugene-matvejev/battleship-game-api

View on GitHub
app/AppKernel.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;

class AppKernel extends Kernel
{
    public function registerBundles() : array
    {
        $bundles = [
            /** SYMFONY */
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            /* new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), */
            /* new Symfony\Bundle\SecurityBundle\SecurityBundle(), */
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            /** EXTRA */
            new JMS\SerializerBundle\JMSSerializerBundle(),
            /** PROJECT */
            new EM\FoundationBundle\FoundationBundle(),
            new EM\GameBundle\GameBundle()
        ];

        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
            $bundles[] = new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle();
            $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();

            if ('dev' === $this->getEnvironment()) {
                $bundles[] = new Nelmio\ApiDocBundle\NelmioApiDocBundle();
                $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
                $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            }
        }

        return $bundles;
    }

    public function getRootDir() : string
    {
        return __DIR__;
    }

    public function getCacheDir() : string
    {
        return "{$this->getRootDir()}/../var/cache/{$this->getEnvironment()}";
    }

    public function getLogDir() : string
    {
        return "{$this->getRootDir()}/../var/logs";
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load("{$this->getRootDir()}/config/config_{$this->getEnvironment()}.yml");
    }
}