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\Config\Adapters;
9:
10: use Nette;
11:
12:
13: /**
14: * Reading and generating PHP files.
15: */
16: class PhpAdapter extends Nette\Object implements Nette\DI\Config\IAdapter
17: {
18:
19: /**
20: * Reads configuration from PHP file.
21: * @param string file name
22: * @return array
23: */
24: public function load($file)
25: {
26: return require $file;
27: }
28:
29:
30: /**
31: * Generates configuration in PHP format.
32: * @return string
33: */
34: public function dump(array $data)
35: {
36: return "<?php // generated by Nette \nreturn " . Nette\PhpGenerator\Helpers::dump($data) . ';';
37: }
38:
39: }
40: