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