1 | <?php |
||
21 | abstract class File |
||
22 | { |
||
23 | /** |
||
24 | * Path to config file. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $filename; |
||
29 | |||
30 | /** |
||
31 | * Path to config file. |
||
32 | * |
||
33 | * @var array |
||
34 | 13 | */ |
|
35 | protected $adapters; |
||
36 | 13 | ||
37 | 13 | /** |
|
38 | * File constructor. |
||
39 | 13 | * |
|
40 | 13 | * @param string $file |
|
41 | 13 | */ |
|
42 | 12 | public function __construct($file) |
|
46 | |||
47 | /** |
||
48 | * Returns the phpbu Configuration. |
||
49 | * |
||
50 | * @param \phpbu\App\Factory $factory |
||
51 | * @return \phpbu\App\Configuration |
||
52 | */ |
||
53 | public function getConfiguration(AppFactory $factory) |
||
68 | |||
69 | /** |
||
70 | * Load all available config adapters. |
||
71 | * |
||
72 | * @param \phpbu\App\Factory $factory |
||
73 | */ |
||
74 | protected function setupAdapters(AppFactory $factory) |
||
80 | |||
81 | /** |
||
82 | * Return a registered adapter. |
||
83 | * |
||
84 | * @param string $name |
||
85 | 13 | * @return \phpbu\App\Adapter |
|
86 | * @throws \phpbu\App\Exception |
||
87 | 13 | */ |
|
88 | protected function getAdapter($name) |
||
95 | |||
96 | /** |
||
97 | 15 | * Return list of adapter configs. |
|
98 | * |
||
99 | 15 | * @return array |
|
100 | 15 | */ |
|
101 | 15 | abstract protected function getAdapterConfigs(); |
|
102 | |||
103 | 15 | /** |
|
104 | 1 | * Set the phpbu application settings. |
|
105 | * |
||
106 | 14 | * @param \phpbu\App\Configuration $configuration |
|
107 | */ |
||
108 | abstract public function setAppSettings(Configuration $configuration); |
||
109 | |||
110 | /** |
||
111 | * Set the php settings. |
||
112 | * Checking for include_path and ini settings. |
||
113 | * |
||
114 | * @param \phpbu\App\Configuration $configuration |
||
115 | */ |
||
116 | abstract public function setPhpSettings(Configuration $configuration); |
||
117 | |||
118 | /** |
||
119 | * Set the log configuration. |
||
120 | * |
||
121 | * @param \phpbu\App\Configuration $configuration |
||
122 | * @throws \phpbu\App\Exception |
||
123 | */ |
||
124 | abstract public function setLoggers(Configuration $configuration); |
||
125 | |||
126 | /** |
||
127 | * Set the backup configurations. |
||
128 | * |
||
129 | * @param \phpbu\App\Configuration $configuration |
||
130 | * @throws \phpbu\App\Exception |
||
131 | */ |
||
132 | abstract public function setBackups(Configuration $configuration); |
||
133 | |||
134 | /** |
||
135 | * Converts a path to an absolute one if necessary. |
||
136 | * |
||
137 | * @param string $path |
||
138 | * @param boolean $useIncludePath |
||
139 | * @return string |
||
140 | */ |
||
141 | protected function toAbsolutePath($path, $useIncludePath = false) |
||
145 | |||
146 | /** |
||
147 | * Return option value. |
||
148 | * Checks if the value should be fetched from an Adapter, if not it just returns the value. |
||
149 | * |
||
150 | * @param string $value |
||
151 | * @return string |
||
152 | */ |
||
153 | protected function getOptionValue($value) |
||
163 | |||
164 | /** |
||
165 | * Load the file. |
||
166 | * |
||
167 | * @param string $filename |
||
168 | * @throws \phpbu\App\Exception |
||
169 | * @return \stdClass |
||
170 | */ |
||
171 | protected function loadFile($filename) |
||
182 | } |
||
183 |