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