1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
4
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
5
|
|
|
|
6
|
|
|
// MRB - Local System Workaround |
7
|
|
|
date_default_timezone_set("America/Denver"); |
8
|
|
|
|
9
|
|
|
class AppKernel extends Kernel |
10
|
|
|
{ |
11
|
|
|
public function registerBundles() |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
$bundles = [ |
15
|
|
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
16
|
|
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(), |
17
|
|
|
new Symfony\Bundle\TwigBundle\TwigBundle(), |
18
|
|
|
new Symfony\Bundle\MonologBundle\MonologBundle(), |
19
|
|
|
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), |
20
|
|
|
new Symfony\Bundle\AsseticBundle\AsseticBundle(), |
21
|
|
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
22
|
|
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
23
|
|
|
new Snc\RedisBundle\SncRedisBundle(), |
24
|
|
|
new FOS\RestBundle\FOSRestBundle(), |
25
|
|
|
new JMS\SerializerBundle\JMSSerializerBundle(), |
26
|
|
|
new Nelmio\CorsBundle\NelmioCorsBundle(), |
27
|
|
|
new AppBundle\AppBundle(), |
28
|
|
|
]; |
29
|
|
|
|
30
|
|
|
if (in_array($this->getEnvironment(), [ 'dev', 'test' ], true)) { |
31
|
|
|
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); |
32
|
|
|
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); |
33
|
|
|
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); |
34
|
|
|
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
return $bundles; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getRootDir() |
41
|
|
|
{ |
42
|
|
|
|
43
|
|
|
return __DIR__; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getCacheDir() |
47
|
|
|
{ |
48
|
|
|
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment().'/'; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getLogDir() |
52
|
|
|
{ |
53
|
|
|
|
54
|
|
|
return dirname(__DIR__).'/var/logs'; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
58
|
|
|
{ |
59
|
|
|
|
60
|
|
|
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.