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: */
7:
8: namespace Nette\Config\Extensions;
9:
10: use Nette;
11:
12:
13: /**
14: * Constant definitions.
15: *
16: * @author David Grudl
17: */
18: class ConstantsExtension extends Nette\Config\CompilerExtension
19: {
20:
21: public function afterCompile(Nette\Utils\PhpGenerator\ClassType $class)
22: {
23: foreach ($this->getConfig() as $name => $value) {
24: $class->methods['initialize']->addBody('define(?, ?);', array($name, $value));
25: }
26: }
27:
28: }
29: