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