1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
6: * @package Nette\Config\Extensions
7: */
8:
9:
10:
11: /**
12: * Constant definitions.
13: *
14: * @author David Grudl
15: * @package Nette\Config\Extensions
16: */
17: class NConstantsExtension extends NConfigCompilerExtension
18: {
19:
20: public function afterCompile(NPhpClassType $class)
21: {
22: foreach ($this->getConfig() as $name => $value) {
23: $class->methods['initialize']->addBody('define(?, ?);', array($name, $value));
24: }
25: }
26:
27: }
28: