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