These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Sonata Project package. |
||
5 | * |
||
6 | * (c) Thomas Rabaix <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Sonata\CacheBundle; |
||
13 | |||
14 | use Sonata\CacheBundle\DependencyInjection\Compiler\CacheCompilerPass; |
||
15 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
16 | use Symfony\Component\HttpKernel\Bundle\Bundle; |
||
17 | |||
18 | class SonataCacheBundle extends Bundle |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
19 | { |
||
20 | public function build(ContainerBuilder $container) |
||
21 | { |
||
22 | parent::build($container); |
||
23 | |||
24 | $container->addCompilerPass(new CacheCompilerPass()); |
||
25 | } |
||
26 | |||
27 | public function boot() |
||
28 | { |
||
29 | $baseTemplateClass = $this->container->get('twig')->getBaseTemplateClass(); |
||
0 ignored issues
–
show
The property
container does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
30 | |||
31 | if (empty($baseTemplateClass)) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | if (method_exists($baseTemplateClass, 'attachRecorder')) { |
||
36 | call_user_func(array($baseTemplateClass, 'attachRecorder'), $this->container->get('sonata.cache.recorder')); |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |