1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
6: */
7:
8: namespace Nette\Bridges\ReflectionDI;
9:
10: use Nette;
11:
12:
13: /**
14: * Extension for Nette DI.
15: *
16: * @author David Grudl
17: */
18: class ReflectionExtension extends Nette\DI\CompilerExtension
19: {
20: /** @var bool */
21: private $debugMode;
22:
23:
24: public function __construct($debugMode = FALSE)
25: {
26: $this->debugMode = $debugMode;
27: }
28:
29:
30: public function afterCompile(Nette\PhpGenerator\ClassType $class)
31: {
32: $class->getMethod('initialize')
33: ->addBody('Nette\Reflection\AnnotationsParser::setCacheStorage($this->getByType("Nette\Caching\IStorage"));')
34: ->addBody('Nette\Reflection\AnnotationsParser::$autoRefresh = ?;', array($this->debugMode));
35: }
36:
37: }
38: