1 | <?php |
||
15 | class Writer |
||
16 | { |
||
17 | |||
18 | const DEFAULT_PREFACE = '# Generated with Jalle19/haphproxy'; |
||
19 | const DEFAULT_INDENT = ' '; |
||
20 | |||
21 | /** |
||
22 | * @var Configuration |
||
23 | */ |
||
24 | private $configuration; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $preface = self::DEFAULT_PREFACE; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $indent = self::DEFAULT_INDENT; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * Writer constructor. |
||
39 | * |
||
40 | * @param Configuration $configuration |
||
41 | */ |
||
42 | public function __construct(Configuration $configuration) |
||
46 | |||
47 | |||
48 | /** |
||
49 | * @param Configuration $configuration |
||
50 | */ |
||
51 | public function setConfiguration($configuration) |
||
55 | |||
56 | |||
57 | /** |
||
58 | * @param string $preface |
||
59 | */ |
||
60 | public function setPreface($preface) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * @param string $indent |
||
68 | */ |
||
69 | public function setIndent($indent) |
||
73 | |||
74 | |||
75 | /** |
||
76 | * @return string the configuration as a string |
||
77 | */ |
||
78 | public function dump() |
||
94 | |||
95 | |||
96 | /** |
||
97 | * @param AbstractSection $section |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | private function writeSection(AbstractSection $section) |
||
113 | |||
114 | |||
115 | /** |
||
116 | * @param Parameter $parameter |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | private function writeParameter(Parameter $parameter) |
||
130 | |||
131 | } |
||
132 |