| 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 |
declare (strict_types=1); |
| 8 |
namespace Packetery\Nette\DI\Config\Adapters; |
| 9 |
|
| 10 |
use Packetery\Nette; |
| 11 |
/** |
| 12 |
* Reading and generating PHP files. |
| 13 |
*/ |
| 14 |
final class PhpAdapter implements \Packetery\Nette\DI\Config\Adapter |
| 15 |
{ |
| 16 |
use \Packetery\Nette\SmartObject; |
| 17 |
/** |
| 18 |
* Reads configuration from PHP file. |
| 19 |
*/ |
| 20 |
public function load(string $file) : array |
| 21 |
{ |
| 22 |
return require $file; |
| 23 |
} |
| 24 |
/** |
| 25 |
* Generates configuration in PHP format. |
| 26 |
*/ |
| 27 |
public function dump(array $data) : string |
| 28 |
{ |
| 29 |
return "<?php // generated by Nette \nreturn " . (new \Packetery\Nette\PhpGenerator\Dumper())->dump($data) . ';'; |
| 30 |
} |
| 31 |
} |
| 32 |
|